Installing Oracle JDK under Ubuntu Linux

Source: Internet
Author: User
Tags java se

installing Oracle JDK under Ubuntu LinuxDennis Hu 2014-4-22
Description:Because very many systems do not support the use of OPENJDK, you will need to install Oracle JDK under Ubuntu. While the installation of Oracle JDK does not seem to provide the apt way, so the way to install Oracle JDK is relatively troublesome, I often install, in order to facilitate others at the same time to check their own, write it down.
First step: differentiate between 32-bit or 64-bit operating systemsMake sure your Ubuntu Linux is 32-bit or 64-bit, and there are a lot of ways to get started.

$uname-A
Step Two: Uninstall OpenJDKRun the following command first to see if OPENJDK is installed, assuming it is already installed. The Java information is displayed. $java-version
Assuming that OPENJDK is installed, you can use the following methods for all uninstalls: $sudo Apt-get purge openjdk-\*
Step three: Download the Oracle JDK version numberNote: Here is an example of Oracle 1.6 64-bit entry into http://www.oracle.com/technetwork/java/javasebusiness/downloads/ java-archive-downloads-javase6-419409.html, select Java SE development Kit 6u45, and then click Accept on the newly opened page Accept License Agreement". After acceptance. Select "Jdk-6u45-linux-x64.bin" to download. Assuming you are not logged in, the system will first go to the login page and enter your username and password on the Oracle site.
Step three: Install Oracle JDK(1) Create Java folder $ sudo mkdir-p/usr/local/java copy your downloaded Jdk-6u45-linux-x64.bin to/usr/local/java folder $ cd/usr/local/java$ sudo Cp/home/dennis/downloads/jdk-6u45-linux-x64.bin.
(2) Extract bin file $ sudo chmod +x jdk-6u45-linux-x64.bin$ sudo./jdk-6u45-linux-x64.bin$ sudo rm-rf jdk-6u45-linux-x64.bin
Fourth Step: Configuring the Orache JDK(1) Configure the Java_home and PATH environment variables $ sudo vi/etc/profile at the end of the file plus for example the following section: java_home=/usr/local/java/jdk1.6.0_45
Path= $PATH: $HOME/bin: $JAVA _home/bin
Export Java_home
Export PATH
(2) Configure Ubuntu JDK and JRE location $ sudo update-alternatives--install "/usr/bin/java" "java" "/usr/local/java/jdk1.6.0_45/bin/ Java "1$ sudo update-alternatives--install"/usr/bin/javac "" Javac ""/usr/local/java/jdk1.6.0_45/bin/javac "1$ sudo Update-alternatives--install "/usr/bin/javaws" "Javaws" "/usr/local/java/jdk1.6.0_45/bin/javaws" 1
(3) Configure Oracle for system default jdk/jre$ sudo update-alternatives--set java/usr/local/java/jdk1.6.0_45/bin/java$ sudo Update-alternatives--set Javac/usr/local/java/jdk1.6.0_45/bin/javac
$ sudo update-alternatives--set javaws/usr/local/java/jdk1.6.0_45/bin/javaws
After the configuration is complete. Run such as the following command to make it effective immediately. $ . /etc/profile run the "java-version" Demo sample again such as the following: [Email protected]:~$ java-version
Java Version "1.6.0_45"
Java (TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot (TM) 64-bit Server VM (build 20.45-b01, Mixed mode)

References: [1] Http://www.wikihow.com/Install-Oracle-Java-JDK-on-Ubuntu-Linux

Installing Oracle JDK under Ubuntu Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.