I unknowingly downloaded the wrong jdk onto my system (openjdk 11) and would prefer java 1.8.0_181 to be installed. I'm just looking to run an application so I believe that jre is all that is needed. I got the official release from http://www.oracle.com/technetwork/java/javase/jre8-downloads-2133155.html for linux x64.

I now have both of these java version on my ubuntu machine. the jdk is located in /usr/lib/jvm/ and I placed the jre folder in /usr/lib/java/. I have set the $JAVA_HOME path to /usr/lib/java/jre1.8.0_181 in both /etc/environment and in ./bashrc.

When I do echo $JAVA_HOME the correct path shows up (jre path). However, when I do java -version, it still shows as java Version 10 instead of 1.8.0_181.

Can anyone assist with this? I'm not sure what else I can do here.


Turns out I needed to set add the lines export JAVA_HOME="/usr/lib/jre1.8.0_181" and export PATH=$JAVA_HOME/bin:$PATH to my ~./profile file. Then turn off my machine and get back on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.