Advanced Java and Web Technologies for JNTUK
Blog providing beginner tutorials on different web technologies like HTML, CSS, Javascript, PHP, MYSQL, XML, Java Beans, Servlets, JSP and AJAX
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Installation. No Comments on Installing Oracle JDK on Ubuntu
0
(0)

This article guides you step by step on Installing Oracle JDK on Ubuntu OS.

  1. 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

 

  1. 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

 

  1. 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-\*

 

  1. Create a directory to hold your Oracle Java JDK and JRE binaries:

sudo mkdir -p /usr/local/java


Subscribe to our monthly newsletter. Get notified about latest articles, offers and contests.


 

  1. Copy the Oracle Java binaries into the /usr/local/java directory:

sudo cp -r jdk-8u40-linux-i586.tar.gz /usr/local/java/

 

  1. Unpack the compressed Java binaries, in the directory /usr/local/java :

sudo tar xvzf jdk-8u40-linux-i586.tar.gz

 

  1. Edit the system PATH file /etc/profile and add the following system variables to your system path:

sudo gedit /etc/profile

 

  1. 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

 

  1. Save the /etc/profile file and exit.

 

  1. 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

 

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

source /etc/profile

 

  1. Test to see if Oracle Java was installed correctly on your system. Run the following commands and note the version of Java: 

java -version

 

  1. 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

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

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.

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

Leave a Reply

Your email address will not be published. Required fields are marked *