I tried to run Kafka on CMD in Windows and it's very unstable , constantly giving errors. Then I came across this post, which suggests installing Ubuntu and run Kafka from there.
I have installed Ubuntu successfully. Given that I have already defined JAVA_HOME=C:\Program Files\Java\jdk1.8.0_231
as one of the environmental variables and CMD recognizes this variable but Ubuntu does not, I am wondering how to make Ubuntu recognize this because at the moment, when i typed java -version
, Ubuntu returns command not found
.
Update: Please note that I have to have Ubuntu's JAVA_HOME
pointing to the evironmental variable JAVA_HOME
defined in my Window system. Because my Java program in eclipse would need to talk to Kafka using the same JVM.
I have added the two lines below in my /etc/profile
file. echo $JAVA_HOME
returns the correct path. However, java -version
returns a different version of Java installed on Ubuntu, not the one defined in the /etc/profile
export JAVA_HOME=mnt/c/Program\ Files/Java/jdk1.8.0_231
export PATH=$JAVA_HOME/bin:$PATH
apt
.JAVA_HOME
doesn't tell the operating system where thejava
executable is. That's whatPATH
is for./etc/profile
take effect either after you log back in or if yousource /etc/profile
. Have you done any of those?export JAVA_HOME=mnt/c/Program\ Files/Java/jdk1.8.0_231
in /etc/profile and have restarted the machine and logged back on but it's still showing a different version of Java, which I installed in Ubuntu earlier by runningsudo apt install openjdk-8-jdk -y