Digital Marketing

How to Install Oracle Java to 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 choose 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.




Comments

Popular posts from this blog

Fixed WSL sshd: no hostkeys available -- exiting

Install Letsencrypt ssl certificate on Glassfish