Digital Marketing

How to Install Oracle Java JDK in Ubuntu Linux

Copy and decompress oracle Java to /usr/local/java

$ sudo mv jdk1.8.0_05/ /usr/local/java

Edit profile:

$ sudo gedit /etc/profile &

Scroll down to the end of the file using your arrow keys and add the following lines below to the end of your /etc/profile file:

export JAVA_HOME
export PATH

Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located. This will tell the system that the new Oracle Java version is available for use.

$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/bin/javaws" 1

Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java.

$ sudo update-alternatives --set java /usr/local/java/bin/java
$ sudo update-alternatives --set javac /usr/local/java/bin/javac
$ sudo update-alternatives --set javaws /usr/local/java/bin/javaws

Reload your system wide PATH /etc/profile by typing the following command:

 $ sudo bash /etc/profile


$ java -version
java version "1.8.0_31"

You can install Oracle Java in Ubuntu Via PPA Repository:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Switch your java to Java 8:

sudo update-java-alternatives -s java-8-oracle

Setting Java environment variables

sudo apt-get install oracle-java8-set-default

See also:

How to Install Oracle Java to Linux

Popular posts from this blog

How to fix Google Apps Script: Script function not found: doGet

Creating sort index in MySQL

Selenium supports Java