1

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)

5
  • 1
    try sudo update-alternatives --config java Commented Jan 25, 2016 at 4:47
  • You could add your desired java binary directory to PATH environment variable. export PATH=$PATH:/usr/java/jdk1.5.0_07/bin Commented Jan 25, 2016 at 4:58
  • askubuntu.com/questions/56104/… Commented Jan 25, 2016 at 5:01
  • mmuzahid I have added the $JAVA_HOME/bin to the PATH environment variable. but still not using this java for java -version Commented Jan 25, 2016 at 5:05
  • @munish, did you reload your bashrc file after modifying PATH by running command something like that source ~/.bashrc Commented Jan 25, 2016 at 5:14

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.