This article is about installing 32-bit and 64-bit Oracle Java 7 JRE (version 1.8.0 _5) on 32-bit and 64-bit Ubuntu operating systems. The methods described in this article also work in Debian and Linux Mint.
This article is intended for anyone looking to install Oracle Java JRE on Debian-based Linux operating systems such as Debian, Ubuntu, and Linux Mint. With the JRE installed, you can run Java programs, but you cannot create (program in Java). This article was written in response to popular demand from users looking to install Oracle Java JRE on Ubuntu systems. This article contains a section on how to enable Oracle Java JRE in web browsers. This Oracle Java JRE installation guide is for Debian, Ubuntu and Linux Mint operating systems.
Steps

Step 1. Determine the bitness of your system (32-bit or 64-bit)
To do this, open a terminal and enter the following command.
- Type / Copy / Paste: file / sbin / init
Remember / write down the bitness of your operating system

Step 2. # Make sure Java is installed on your system
Enter the command to check the Java version in Terminal.
- Open a terminal and enter the following command:
Type / Copy / Paste: java –version
- If you have OpenJDK installed, the following information will be displayed on the screen:
-
java version "1.7.0_15"
OpenJDK Runtime Environment (IcedTea6 1.10pre) (6b15 ~ pre1-0lucid1)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
-
- If you have OpenJDK installed, then your Java version does not match the version used in this article.

Step 3. Completely remove OpenJDK / JRE from your system and create a folder to store the Oracle Java JRE binaries
This way you prevent conflicts between different Java versions. If you have OpenJDK / JRE installed, uninstall it by typing the following command in the terminal:
- Type / Copy / Paste: sudo apt-get purge openjdk - \ *
This command will completely remove OpenJDK / JRE from the system
- Type / Copy / Paste: sudo mkdir -p / usr / local / java
This command will create a folder to store Oracle Java JDK / JRE files

Step 4. Download Oracle Java JRE for Linux
Make sure you select the correct (for your system's size) compressed tar.gz files.
- For example, if you are using a 32-bit operating system, download Oracle Java 32-bit.
- For example, if you are using a 64-bit operating system, download 64-bit Oracle Java.
- If necessary, Download Oracle Java JDK / JRE Documentation
Select jdk-7u40-apidocs.zip
- Important: 64-bit Oracle Java does not work on 32-bit Ubuntu Linux operating systems. When trying to install 64-bit Oracle Java on 32-bit Ubuntu Linux, you will receive an error.

Step 5. Copy the Oracle Java binaries to the / usr / local / java folder
Typically, Oracle Java files are downloaded to / home / username / Downloads.
- Instructions for 32-bit Oracle Java:
- Type / copy / paste: cd / home / username / Downloads
- Type / Copy / Paste: sudo cp -r jre-8u5-linux-i586.tar.gz / usr / local / java
- Type / Copy / Paste: cd / usr / local / java
- Instructions for 64-bit Oracle Java:
- Type / copy / paste: cd / home / username / Downloads
- Type / Copy / Paste: sudo cp -r jre-8u5-linux-x64.tar.gz / usr / local / java
- Type / Copy / Paste: cd / usr / local / java

Step 6. Run the following commands (against the downloaded tar.gz files)
Execute these commands from under the root. To do this, open a terminal, enter sudo -s and enter the administrative password.
- Instructions for 32-bit Oracle Java:
Type / Copy / Paste: sudo chmod a + x jre-8u5-linux-i586.tar.gz
- Instructions for 64-bit Oracle Java:
Type / Copy / Paste: sudo chmod a + x jre-8u5-linux-x64.tar.gz

7 Unpack the compressed Java files to the / usr / local / java folder
- Instructions for 32-bit Oracle Java:
Type / Copy / Paste: sudo tar xvzf jre-8u5-linux-i586.tar.gz
- Instructions for 64-bit Oracle Java:
Type / Copy / Paste: sudo tar xvzf jre-8u5-linux-x64.tar.gz

Step 8. Check the folders again
At this point, in / usr / local / java, you should have two folders listed as:
- Type / Copy / Paste: ls -a
- jre1.8.0_05

Step 9. Edit the system file / etc / profile and add the following system variables
As root, use gedit, nano, or any other text editor to open / etc / profile.
- Type / copy / paste: sudo gedit / etc / profile
- or
- Type / copy / paste: sudo nano / etc / profile

Step 10. Go to the end of the / etc / profile file and add the following lines (at the very end of the file)
-
Type / copy / paste:
JAVA_HOME = / usr / local / java /jre1.7.0_45
PATH = $ PATH: $ HOME / bin: $ JAVA_HOME / bin
export JAVA_HOME
export PATH

Step 11. Save the file and close it

Step 12. Point the system to the location of the updated version of Oracle Java JRE (the system will switch to using the new version of Oracle Java)
- Type / copy / paste: sudo update-alternatives --install "/ usr / bin / java" "java" usr / local / java / JRE1.8.0_05 / bin / java "1
This command notifies the system that the Oracle Java JRE is available for use
- Type / Copy / Paste: sudo update-alternatives --install "/ usr / bin / javaws" "javaws" "/usr/local/java/jre1.8.0_05/bin/javaws" 1
This command notifies the system that Oracle Java Web Start is available for use

Step 13. Tell the system that the updated version of the Oracle Java JRE will be the default Java version
- Type / Copy / Paste: sudo update-alternatives --set java /usr/local/java/JRE1.8.0_05/bin/java
This command will install the Java runtime environment
- Type / Copy / Paste: sudo update-alternatives --set javaws /usr/local/java/jre1.8.0_05/bin/javaws
This command will install Java Web Start

Step 14. Reload the system file / etc / profile with the following command
- Type / copy / paste:. / etc / profile
- Note that the / etc / profile file will reload after a system reboot.

Step 15. Check the correctness of the installation of the new version of Oracle Java using the following commands (look at the number of the current Java version)

Step 16. Upon successful installation of 32-bit Oracle Java
- Type / Copy / Paste: java -version
This command will display on the screen the Java version number that is currently running
- You will see the following message:
-
java version "1.8.0_05"
Java (TM) SE Runtime Environment (build 1.8.0_05-b18)
Java HotSpot (TM) Server VM (build 24.45-b08, mixed mode)
-

Step 17. Upon successful installation of 64-bit Oracle Java
- Type / Copy / Paste: java -version
This command will display on the screen the Java version number that is currently running
- You will see the following message:
-
java version "1.8.0_05"
Java (TM) SE Runtime Environment (build 1.8.0_05-b18)
Java HotSpot (TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
-

Step 18. You have installed Oracle Java on your Linux system
Now reboot your system. After rebooting, the system will be ready to run Java programs.
Optional: How to enable Oracle Java in your browser
To enable the Java plugin in your browser, you must make a symbolic link from the browser plugins folder to the location of the Java plugin included with your Oracle Java distribution
Important information
Be careful when enabling Oracle Java 8 in your browser as Oracle Java 8 has security issues (Oracle Java 8 vulnerabilities could be exploited by hackers). For more information on Java security issues, open the following site: Java Tester
Google chrome
Instructions for 32-bit Oracle Java:
- Enter the following commands.
- Type / copy / paste: sudo mkdir -p / opt / google / chrome / plugins
This will create a folder / opt / google / chrome / plugins
- Type / copy / paste: cd / opt / google / chrome / plugins
This will take you to the google chrome plugins folder; make sure you are in this folder before creating the link
- Type / Copy / Paste: sudo ln -s /usr/local/java/jre1.8.0_05/lib/i386/libnpjp2.so
- This will create a link between Java JRE (Java Runtime Environment) plugin libnpjp2.so and Google Chrome browser
- Type / copy / paste: sudo mkdir -p / opt / google / chrome / plugins
Instructions for 32-bit Oracle Java:
- Enter the following commands.
- Type / copy / paste: sudo mkdir -p / opt / google / chrome / plugins
This will create a folder / opt / google / chrome / plugins
- Type / copy / paste: cd / opt / google / chrome / plugins
This will take you to the google chrome plugins folder; make sure you are in this folder before creating the link
- Type / copy / paste: sudo ln -s /usr/local/java/jre1.8.0_05/lib/amd64/libnpjp2.so
- This will create a link between Java JRE (Java Runtime Environment) plugin libnpjp2.so and Google Chrome browser
- Type / copy / paste: sudo mkdir -p / opt / google / chrome / plugins
Reminders
- Attention! Sometimes, when entering the above commands, the following message may appear:
- ln: creating symbolic link `./libnpjp2.so ': File exists
- To fix this error, remove the previous link with the following command:
- Type / copy / paste: cd / opt / google / chrome / plugins
- Type / Copy / Paste: sudo rm -rf libnpjp2.so
- Make sure you are in the / opt / google / chrome / plugins folder before entering this command.
- Restart your browser and open Java Tester to test if Java is working correctly in your browser.
Mozilla Firefox
Instructions for a 32-bit system
- Enter the following commands.
- Type / Copy / Paste: cd / usr / lib / mozilla / plugins
This will take you to the / usr / lib / mozilla / plugins folder; if such folder does not exist, create it
- Type / Copy / Paste: sudo mkdir -p / usr / lib / mozilla / plugins
This will create the / usr / lib / mozilla / plugins folder; make sure you are in this folder before creating the link
- Type / Copy / Paste: sudo ln -s /usr/local/java/jre1.8.0_05/lib/i386/libnpjp2.so
- This will create a link between Java JRE (Java Runtime Environment) plugin libnpjp2.so and Mozilla Firefox browser
- Type / Copy / Paste: cd / usr / lib / mozilla / plugins
Instructions for a 64-bit system:
- Enter the following commands.
- Type / Copy / Paste: cd / usr / lib / mozilla / plugins
This will take you to the / usr / lib / mozilla / plugins folder; if such folder does not exist, create it
- Type / Copy / Paste: sudo mkdir -p / usr / lib / mozilla / plugins
This will create the / usr / lib / mozilla / plugins folder; make sure you are in this folder before creating the link
- Type / Copy / Paste: sudo ln -s /usr/local/java/jre1.8.0_05/lib/amd64/libnpjp2.so
- This will create a link between Java JRE (Java Runtime Environment) plugin libnpjp2.so and Mozilla Firefox browser
- Type / Copy / Paste: cd / usr / lib / mozilla / plugins
Reminders
- Attention! Sometimes, when entering the above commands, the following message may appear:
- ln: creating symbolic link `./libnpjp2.so ': File exists
- To fix this error, remove the previous link with the following command:
- Type / Copy / Paste: cd / usr / lib / mozilla / plugins
- Type / Copy / Paste: sudo rm -rf libnpjp2.so
- Make sure you are in the / usr / lib / mozilla / plugins folder before entering this command.
- Restart your browser and open Java Tester to test if Java is working properly in your browser.
- Enter the following commands.