Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
Setting up JAVA_HOME in Ubuntu to point to Window's JAVA_HOME

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
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

When the user logs in, the environment will be loaded from the /etc/profile and $HOME/.bashrc files. There are many ways to solve this problem. You can execute ex manually

export JAVA_HOME=/opt/jdk1.8.0_66
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

or fix the configuration in /etc/profile or $HOME/.bashrc

export JAVA_HOME=/opt/jdk1.8.0_66
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
over 4 years ago · Santiago Trujillo Denunciar

0

You can edit /etc/profile, append

export JAVA_HOME=C:\Program Files\Java\jdk1.8.0_231

export PATH=$JAVA_HOME/bin:$PATH
over 4 years ago · Santiago Trujillo Denunciar

0

You have 2 issues. Firstly you omitted the "/" from the beginning of the environment variable so your JAVA_HOME would not work unless you cd / as "mnt" won't exist.

export JAVA_HOME=/mnt/c/Program\ Files/Java/jdk1.8.0_231
export PATH=$JAVA_HOME/bin:$PATH

Secondly, if you use a Windows JDK the executable is java.exe

java.exe -version

Also consider when using WSL that WSL1 is faster when accessing Windows OS disk - helpful if using java.exe, and that WSL2 is faster for Linux mount drives - and you may be better off using Linux binaries in favour of Windows binaries as suggested in your Kafka post.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda