0

I downloaded the java latest version from http://www.oracle.com/technetwork/java/javase/downloads/index.html this site for Linux 64-bit. I installed default-jdk, now when i run $java -version this command i got

java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-0ubuntu0.14.04.3)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)

Now i would like to configure java what i have downloaded. Is it possible to configure manually to the latest version?

Thanks & Regards

Jaccs
  • 942
  • 3
  • 10
  • 31

2 Answers2

0

You can edit file /etc/profile with sudo and add following lines at the end:

export JAVA_HOME="/path/to/java/folder"
export PATH=$JAVA_HOME/bin:$PATH

My example:

export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
export PATH=$JAVA_HOME/bin:$PATH

Then save the file, and enter source /etc/profile in the terminal. Then relaunch the terminal and check the version again.

Alexiy
  • 1,838
  • 15
  • 18
  • I edited that /etc/profile and i added export JAVA_HOME="/usr/lib/jvm/jdk1.8.0_101" export PATH=$JAVA_HOME/bin:$PATH These two line at the end of file. Still i can't able to get latest version config when running java -version. – Jaccs Sep 01 '16 at 08:53
0

Kiran , you will have to set the right alternatives once you install the Oracle JDK. A very detailed explanation of it is available here. The alternatives can be listed as

sudo update-alternatives --config java 

you can then choose the JDK of choice

The Path that you have right now points to the Open JDK. You may have to edit your .bash files and add the path to the Oracle JDK binaries as well

Ramachandran.A.G
  • 4,110
  • 1
  • 10
  • 20
  • where can i found .bash and Oracle JDK binaries? – Jaccs Sep 01 '16 at 08:49
  • you may have to execute whereis java , the default i believe is in /usr/lib/jvm/... (refer this :https://stackoverflow.com/questions/16931327/where-is-the-java-sdk-folder-in-my-computer-ubuntu-12-04) – Ramachandran.A.G Sep 01 '16 at 09:17