How to configure Java 1.8 in Ubuntu 14.04?

时间:2016-09-01 06:08:52

标签: java java-8 ubuntu-14.04

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

2 个答案:

答案 0 :(得分: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.

答案 1 :(得分: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