You are viewing the article How to Install Oracle Java on Ubuntu Linux at Lassho.edu.vn you can quickly access the necessary information in the table of contents of the article below.
wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 35 people, some of whom are anonymous, have edited and improved the article over time.
This article has been viewed 10,730 times.
This article will guide to install Oracle Java 7 32-bit and 64-bit (current version is 1.7.0_45 ) JDK/JRE on 32-bit and 64-bit Ubuntu operating systems. You can apply this guide to Debian and Linux Mint.
If you have installed Oracle Java 7 on the operating system but want to upgrade, please refer to the tutorial to upgrade Oracle Java on Ubuntu Linux.
For those who just want to install Oracle Java JRE to run Java applications and not develop Java programs, please refer to the tutorial on installing Oracle Java JRE on Ubuntu Linux.
For those who want to install Oracle Java JDK to develop Java programs and applications (Oracle Java JRE includes Oracle JDK), use the following method:
- How to Install Oracle Java JDK on Ubuntu Linux
To activate/upgrade Oracle Java on a web browser, refer to the tutorial on activating Oracle Java on a web browser.
- Type/Copy/Paste: file /sbin/init
- Remember whether the version of the Ubuntu Linux operating system is 32-bit or 64-bit.
- Open terminal and enter the following command:
- Type/Copy/Paste: java -version
- If you have OpenJDK installed on your system, you will see the message:
- java version “1.7.0_15”
OpenJDK Runtime Environment (IcedTea6 1.10pre) (7b15~pre1-0lucid1)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
- java version “1.7.0_15”
- If you have OpenJDK installed on your system then this is not the vendor version mentioned in this article.
- Type/Copy/Paste: sudo apt-get purge openjdk-*
- This is the command to completely remove OpenJDK/JRE from the system.
- Type/Copy/Paste: sudo mkdir -p /usr/local/java
- This is the command to create a new directory to store the Oracle Java JDK and JRE binaries.
- For example, if using Ubuntu Linux 32-bit, download the 32-bit Oracle Java binary.
- For example, if using Ubuntu Linux 64-bit, download the 64-bit Oracle Java binary.
- Optional, Download Oracle Java JDK/JRE . Documentation
- Select jdk-7u40-apidocs.zip
- Important information: 64-bit Oracle Java binary does not work on 32-bit Ubuntu Linux operating system, many system error messages will appear if you intentionally install 64-bit Oracle Java on Ubuntu Linux 32- bits.
- Instructions for installing 32-bit Oracle Java on 32-bit Ubuntu Linux:
- Type/Copy/Paste: cd ~/Downloads
- Type/Copy/Paste: sudo cp -r jdk-7u45-linux-i586.tar.gz /usr/local/java
- Type/Copy/Paste: sudo cp -r jre-7u45-linux-i586.tar.gz /usr/local/java
- Type/Copy/Paste: cd /usr/local/java
- Instructions to install Oracle Java 64-bit on Ubuntu Linux 64-bit:
- Type/Copy/Paste: cd ~/Downloads
- If you download JDK then Type/Copy/Paste: sudo cp -r jdk-7u45-linux-x64.tar.gz /usr/local/java
- Or if you load the JRE then Type/Copy/Paste: sudo cp -r jre-7u45-linux-x64.tar.gz /usr/local/java
- Type/Copy/Paste: cd /usr/local/java
- Instructions for installing 32-bit Oracle Java on 32-bit Ubuntu Linux:
- Type/Copy/Paste: sudo tar xvzf jdk-7u45-linux-i586.tar.gz
- Type/Copy/Paste: sudo tar xvzf jre-7u45-linux-i586.tar.gz
- Instructions to install Oracle Java 64-bit on Ubuntu Linux 64-bit:
- If you download JDK then Type/Copy/Paste: sudo tar xvzf jdk-7u45-linux-x64.tar.gz
- If you download the JRE then Type/Copy/Paste: sudo tar xvzf jre-7u45-linux-x64.tar.gz
- Type/Copy/Paste: ls -a
- jdk1.7.0_45
- or jre1.7.0_45
- Type/Copy/Paste: sudo gedit /etc/profile
- or
- Type/Copy/Paste: sudo nano /etc/profile
- If you install JDK then Type/Copy/Paste:
JAVA_HOME=/usr/local/java/ jdk1.7.0_45
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH - If you install JRE then Type/Copy/Paste:
JRE_HOME=/usr/local/java/ jre1.7.0_45
PATH=$PATH:$JRE_HOME/bin
export JRE_HOME
export PATH - Save the file /etc/profile and exit.
- If you install JDK then Type/Copy/Paste: sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.7.0_45/jre/bin/java” first
- If you install JRE then Type/Copy/Paste: sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jre1.7.0_45/bin/java” 1
- This is a command that notifies the system that the Oracle Java JRE is ready for use.
- Only if you install JDK then Type/Copy/Paste: sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.7.0_45/bin/java” 1
- This is the command that notifies the system that the Oracle Java JDK is ready for use.
- Type/Copy/Paste: sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jre1.7.0_45/bin/javaws” 1
- This is a command that notifies the system that Oracle Java Web is ready for use.
- If you install JDK then Type/Copy/Paste: sudo update-alternatives –set java /usr/local/java/jdk1.7.0_45/jre/bin/java
- If you install JRE then Type/Copy/Paste: sudo update-alternatives –set java /usr/local/java/jre1.7.0_45/bin/java
- This is the command to set up the java runtime environment for the system.
- Only when installing JDK then Type/Copy/Paste: sudo update-alternatives –set java /usr/local/java/jdk1.7.0_45/bin/java
- This is the command to set up the java compiler for the system.
- If you install JDK then Type/Copy/Paste: sudo update-alternatives –set javaws /usr/local/java/jdk1.7.0_45/bin/javaws
- Or if you install JRE then Type/Copy/Paste: sudo update-alternatives –set javaws /usr/local/java/jre1.7.0_45/bin/javaws
- This is the command to set up Java Web to start on the system.
- Type/Copy/Paste: . /etc/profile
- Note the system path /etc/profile file will reload after rebooting Ubuntu Linux system.
- Type/Copy/Paste: java -version. This is the command to display the java version on the system. You will see the message: java version “1.7.0_45”
Java(TM) SE Runtime Environment (build 1.7.0_45-b18) - Java HotSpot(TM) Server VM (build 24.45-b08, mixed mode)
- Type/Copy/Paste: java -version. This is the command that says you can now compile Java programs from the terminal. You will get the following message: java 1.7.0_45. A successful installation of Oracle Java 64-bit will display:
- Type/Copy/Paste: java -version. This is the command that shows the java version running on the system. You will get the following message: java version “1.7.0_45”
Java(TM) SE Runtime Environment (build 1.7.0_45-b18) - Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
- Type/Copy/Paste: java -version. This is the command that says you can now compile Java programs from the terminal. You will get display message: java 1.7.0_45
Google Chrome
Oracle Java 32-bit Tutorial:
- Type/Copy/Paste: sudo mkdir -p /opt/google/chrome/plugins
- Here is the command to create the directory /opt/google/chrome/plugins
- Type/Copy/Paste: cd /opt/google/chrome/plugins
- This is the command that takes you to the google chrome plugin folder, remember to go to this folder before creating the icon link
- Type/Copy/Paste: sudo ln -s /usr/local/java/jre1.7.0_45/lib/ i386 / libnpjp2.so
- This is the command to create a symbolic link from the Java JRE( Java Runtime Environment ) plugin libnpjp2.so to the Google Chrome browser.
Oracle Java 64-bit Tutorial:
- Type/Copy/Paste: sudo mkdir -p /opt/google/chrome/plugins
- Here is the command to create the directory /opt/google/chrome/plugins
- Type/Copy/Paste: cd /opt/google/chrome/plugins
- This is the command that takes you into the google chrome plugin directory, make sure you go into the directory before creating the icon link.
- Type/Copy/Paste: sudo ln -s /usr/local/java/jre1.7.0_45/lib/ amd64 / libnpjp2.so
- This is the command to create a symbolic link from the Java JRE (Java Runtime Environment) plugin libnpjp2.so to the Google Chrome browser.
Remind:
- ln: creating symbpic link `./libnpjp2.so’: File exists
- To fix this problem, simply 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 directory before executing the command.
Mozilla Firefox
Oracle Java 32-bit Tutorial:
- Type/Copy/Paste: cd /usr/lib/mozilla/plugins
- This is the command that takes you to the plugin directory /usr/lib/mozilla/plugins, create this directory if not already there.
- Type/Copy/Paste: sudo mkdir -p /usr/lib/mozilla/plugins
- Here is the command to create the directory /usr/lib/mozilla/plugins, make sure you are in the directory before creating the symbolic link.
- Type/Copy/Paste: sudo ln -s /usr/local/java/jre1.7.0_45/lib/ i386 / libnpjp2.so
- This is the command to create a symbolic link from the Java JRE(Java Runtime Environment) plugin libnpjp2.so to the Mozilla Firefox web browser.
Oracle Java 64-bit Tutorial:
- Type/Copy/Paste: cd /usr/lib/mozilla/plugins
- This is the command that takes you to the /usr/lib/mozilla/plugins directory, create this directory if it’s not already there.
- Type/Copy/Paste: sudo mkdir -p /usr/lib/mozilla/plugins
- Here is the command to create the directory /usr/lib/mozilla/plugins, make sure you are in the directory before creating the symbolic link.
- Type/Copy/Paste: sudo ln -s /usr/local/java/jre1.7.0_45/lib/ amd64 / libnpjp2.so
- This is the command to create a symbolic link from the Java JRE(Java Runtime Environment) plugin libnpjp2.so to the Mozilla Firefox web browser.
Remind:
- ln: creating symbpic link `./libnpjp2.so’: File exists
- To fix this problem, simply 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 directory before executing the command.
Advice
- With Ubuntu Linux, you can choose between OpenJDK, the free, open source Java programming language; or Oracle Java JDK and JRE. Some people prefer to use Oracle Java (because it is the most up-to-date version of Java and comes from the maintainers of Java technology) but also different.
- Please keep in mind that Oracle upgrades security, fixes bugs, and improves performance with each Oracle Java update. When installing Oracle Java on your system, pay attention to the version number. Refer to more articles on how to upgrade Oracle Java on Linux.
- Note that this article is constantly revised because Oracle sometimes changes the method of installing the Java JDK/JRE binary.
wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 35 people, some of whom are anonymous, have edited and improved the article over time.
This article has been viewed 10,730 times.
This article will guide to install Oracle Java 7 32-bit and 64-bit (current version is 1.7.0_45 ) JDK/JRE on 32-bit and 64-bit Ubuntu operating systems. You can apply this guide to Debian and Linux Mint.
If you have installed Oracle Java 7 on the operating system but want to upgrade, please refer to the tutorial to upgrade Oracle Java on Ubuntu Linux.
For those who just want to install Oracle Java JRE to run Java applications and not develop Java programs, please refer to the tutorial on installing Oracle Java JRE on Ubuntu Linux.
For those who want to install Oracle Java JDK to develop Java programs and applications (Oracle Java JRE includes Oracle JDK), use the following method:
- How to Install Oracle Java JDK on Ubuntu Linux
To activate/upgrade Oracle Java on a web browser, refer to the tutorial on activating Oracle Java on a web browser.
Thank you for reading this post How to Install Oracle Java on Ubuntu Linux at Lassho.edu.vn You can comment, see more related articles below and hope to help you with interesting information.
Related Search: