This article guides you step by step on Installing Oracle JDK on Ubuntu OS.
- Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below:
file /sbin/init
- Check if you have Java installed on your system. To do this, you will have to run the Java version command from terminal:
java -version
- Completely remove the OpenJDK/JRE from your system and create a directory to hold your Oracle Java JDK/JRE binaries:
sudo apt-get purge openjdk-\*
- Create a directory to hold your Oracle Java JDK and JRE binaries:
sudo mkdir -p /usr/local/java
- Copy the Oracle Java binaries into the /usr/local/java directory:
sudo cp -r jdk-8u40-linux-i586.tar.gz /usr/local/java/
- Unpack the compressed Java binaries, in the directory /usr/local/java :
sudo tar xvzf jdk-8u40-linux-i586.tar.gz
- Edit the system PATH file /etc/profile and add the following system variables to your system path:
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:
JAVA_HOME=/usr/local/java/jdk1.8.0_40
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
- Save the /etc/profile file and exit.
- Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located:
sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_40/bin/java” 1
sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.8.0_40/bin/javac” 1
sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jdk1.8.0_40/bin/javaws” 1
11.Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java:
sudo update-alternatives –set java /usr/local/java/jdk1.8.0_40/bin/java
sudo update-alternatives –set javac /usr/local/java/jdk1.8.0_40/bin/javac
sudo update-alternatives –set javaws /usr/local/java/jdk1.8.0_40/bin/javaws
- Reload your system wide PATH /etc/profile by typing the following command:
source /etc/profile
- Test to see if Oracle Java was installed correctly on your system. Run the following commands and note the version of Java:
java -version
- Congratulations, you just installed Oracle Java on your Linux system.
Download the above instructions in PDF format here
For more detailed instructions, visit: http://www.wikihow.com/Install-Oracle-Java-JDK-on-Ubuntu-Linux
Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.
Leave a Reply