WikiHow to Install Oracle Java JDK on Ubuntu Linux
This tutorial would cover the installation of 32-bit and 64-bit Oracle Java 8 (currently version number 1.8.0_20) JDK on 32-bit and 64-bit Ubuntu operating systems. These instructions'll also work on Debian and Linux Mint.
This article are for those who only want to install the Oracle Java JDK with the Oracle Java JRE included in the JDK Downlo Ad. Instructions for "Install Oracle Java JDK only on Debian based Linux operating systems such as Debian, Ubuntu and Li Nux Mint.
Steps
- 1Check to see if your Ubuntu Linux operating system architecture are 32-bit or 64-bit, open up a terminal and run the F ollowing command below.
- type/copy/paste: file/sbin/init
- Note the bit version of your Ubuntu Linux operating system architecture It would display whether it is 32-bit or 64-bit.
- 2check if you had Java installed on your system. to do this and you'll have a to run with the Java version command from terminal.
- Open up a terminal and enter the following command:
- type/copy/paste: java -version
- If you had OpenJDK installed on your system it could look like this:
- JAV A version "1.7.0_15"
OpenJDK Runtime Environment (IcedTea6 1.10pre) (7B15~PRE1-0LUCID1)
OpenJDK 64-bit Server VM (b Uild 19.0-b09, Mixed mode)
- If you had OpenJDK installed on your system and you had the wrong vendo R version of Java installed for this exercise.
- 3completely remove the OPENJDK/JRE from your system and create a directory to Hol D your Oracle Java jdk/jre binaries. this would prevent system conflicts and confusion between different vendor versions of Java. For example, if you had the OPENJDK/JRE installed on your system, you can remove it by typing the following at the Comman D Line:
- type/copy/paste: sudo apt-get purge openjdk-\*
- this command would Completely remove OPENJDK/JRE from your system
- type/copy/paste: sudo mkdir -p/usr/local/java
- This command would create a directory to hold your Oracle Java JDK and JRE binaries.
- 4Download The Oracle Java JDK for Linux. Make sure your select the correct compressed binaries for your system architecture 32-bit or 64-bit (which end in tar.gz).
- For example, if is on Ubuntu Linux 32-bit operating system download 32-bit Oracle Java binaries.
- For example, if is on Ubuntu Linux 64-bit operating system download 64-bit Oracle Java binaries.
- Optional, Download the Oracle Java JDK documentation
- Select Jdk-8u20-apidocs.zip
- Important Information: 64-bit Oracle Java binaries do don't work in 32-bit Ubuntu Linux operating systems, you'll Receive multiple system error messages, if you attempt to install 64-bit Oracle Java on 32-bit Ubuntu Linux.
- 5Copy the Oracle Java binaries into The/usr/local/java directory.In most cases, the Oracle Java binaries is downloaded to:/home/"Your_user_name"/downloads.
- 32-bit Oracle Java on 32-bit Ubuntu Linux installation Instructions:
- type/copy/paste: cd/home/"Your_user_name"/downloads
- type/copy/paste: sudo cp-r jdk-8u20-linux-i586.tar.gz/usr/local/java/
- type/copy/paste: Cd/usr/local/java
- 64-bit Oracle Java on 64-bit Ubuntu Linux installation Instructions:
- type/copy/paste: cd/home/"Your_user_name"/downloads
- type/copy/paste: sudo cp-r jdk-8u20-linux-x64.tar.gz/usr/local/java/
- type/copy/paste: Cd/usr/local/java
- 6Unpack The compressed Java binaries, in the Directory/usr/local/java
- 32-bit Oracle Java on 32-bit Ubuntu Linux installation Instructions:
- type/copy/paste: sudo tar xvzf jdk-8u20-linux-i586.tar.gz
- 64-bit Oracle Java on 64-bit Ubuntu Linux installation Instructions:
- type/copy/paste: sudo tar xvzf jdk-8u20-linux-x64.tar.gz
- 7Double-check your directories. At here, you should has a uncompressed binary directories In/usr/local/java for the Java JDK/JRE listed as:
- type/copy/paste: ls-a
- Jdk1.8.0_20
- Jre1.8.0_20
- 8Edit The system path File/etc/profile and add the following system variables to your system path. Use Nano, gedit or any other text editor, as root, open up/etc/profile.
- type/copy/paste: sudo gedit/etc/profile
- Or
- type/copy/paste: sudo nano/etc/profile
- 9 Scroll down to the end of thefile using your arrow keys and add the following lines below to the end of YOUR/ETC/PR Ofile File:
- Type/copy/paste:
java_home=/usr/local/java/jdk1.8.0_20
jre_home=/usr/local/java/jre1.8.0_20
Path= $PATH: $JRE _home/bin: $JAVA _home/bin
Export Java_home
Export Jre_home
Export PATH
- Save the/etc/profile file and exit.
- 11Inform your Ubuntu Linux system where your Oracle Java Jdk/jre is located.This would tell the system, the new Oracle Java version is available for use.
- type/copy/paste: sudo update-alternatives--install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_20/bin /java "1
- This command notifies the system, Oracle Java JRE is available for use
- type/copy/paste: sudo update-alternatives--install "/usr/bin/javac" "Javac" "/usr/local/java/jdk1.8.0_20/ Bin/javac "1
- This command notifies the system, Oracle Java JDK is available for use
- type/copy/paste: sudo update-alternatives--install "/usr/bin/javaws" "Javaws" "/usr/local/java/jdk1.8.0_20 /bin/javaws "1
- This command notifies the system, Oracle Java Web start is available
- 12inform your Ubuntu Linux system, Oracle Java JDK/JRE must be the default Ja Va.
- type/copy/paste: sudo update-alternatives--set java/usr/local/java/jdk1.8.0_20/bin /java
- This command would set the Java Runtime Environment for the system
- T Ype/copy/paste: sudo update-alternatives--set javac/usr/local/java/jdk1.8.0_20/bin/javac
- t His command would set the Javac compiler for the system
- type/copy/paste: sud o update-alternatives--set javaws/usr/local/java/jdk1.8.0_20/bin/javaws
- This command would set Java Web s Tart for the system
- Reload your system wide path/etc/profile by typing the following command:
- type/copy/paste: source/etc/profile
- Note your system-wide path/etc/profile file would reload after reboot of your Ubuntu Linux system
- Test to see if Oracle Java is installed correctly on your system. Run the following commands and note the version of Java:
- 15a successful installation of 32-bit Oracle Java would display:
- type/copy/paste: java-version
- This command displays the version of the Java running On your system
- should receive a message which displays:
- java version 1.8.0_
Java (tm) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot (tm) Server VM (build 25.20-b23, mixed mode)
- type/copy/paste: javac-version
- this Comman D lets you know this is now able to compile Java programs from the terminal.
- You should receive a message which displays:
&nbs P;
- 16a successful installation of Oracle Java 64-bit would display:
- type/copy/paste: java-version
- This command displays the version of the Java running On your system
- should receive a message which displays:
- java version 1.8.0_
Java (tm) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot (tm) Server VM (build 25.20-b23, mixed mode)
- type/copy/paste: javac-version
- this Comman D lets you know this is now able to compile Java programs from the terminal.
- You should receive a message which displays:
&nbs P;
- Congratulations, just installed Oracle Java on your Linux system. Now reboot your Ubuntu Linux system. Afterwards, your system would be fully configured for running and developing Java programs. Later on the want to try compiling and running your own Java programs by following this article how to Create your Fir St Java program on Ubuntu Linux
Install JDK on Ubuntu16