How to Install and configure Oracle Java/JDK on Linux

Download java package from oracle and install it.

(See: How to download JDK directly from Oracle from command line)


for RedHat/CentOS/Fedora, the location of the installation is /usr/java/latest

$ sudo -i alternatives --install /usr/bin/java java /usr/java/latest/bin/java 1

1 is for the priority.

for Ubuntu:

$ sudo -i update-alternatives --install /usr/bin/java java /home/i88ca/Downloads/jdk1.8.0_05/bin/java 1

You can put "" if you have special character, such as:

$ sudo -i update-alternatives --install /usr/bin/java java "/home/i88ca/Downloads/jdk1.8.0_05/bin/java" 1

Run the alternatives program again, to chose the new installation
for RedHat:

$ sudo -i alternatives --config java

for Ubuntu:

$ sudo update-alternatives --config java

Verify that you are getting the right version of Java

$ java -version

You may want to configure javac too, just do similar as above, change java to corresponding javac of course.





Featured Post

Biz & Tech Summit Pitch Startup Competition is coming up.

This is a great opportunity to get exposure for your startup and potentially win some prizes.