munish
munish

Reputation: 485

java -version is giving me the version of openJDK installed, instead of JRE in $JAVA_HOME

I have downloaded the java jdk from Oracle website and extracted it in the system. I have also don the entry of $JAVA_HOME to this one.

But I have to install dbeaver (sql client) software which also installs openjdk with it.

Now my system has two jres. OpenJDK and Oracle($JAVA_HOME). Whenever I am doing

java -version

It's giving me the version of that OpenJDK jre. Is it possible to make system use the Oracle jre(manually installed) instead of OpenJDK jre(keeping that installed in the system)

Upvotes: 1

Views: 3721

Answers (1)

Prem Kurian Philip
Prem Kurian Philip

Reputation: 306

Try:

    whereis java

This will give you the path to the java binary as your system is finding it from the path.

If the path to the java binary is pointing to a different directory, then see the output of

    echo $PATH

You may find that the path to the OpenJDK bin directory is already in the PATH variable. You will need to remove this from the path.

Also, please do run the command given below to ensure that the alternatives have been updated correctly.

   sudo update-alternatives --config java

Follow the steps given here: How to install Oracle Java in Ubuntu 16.04

Upvotes: 3

Related Questions