Install Oracle JDK in Ubuntu Linux

Source: Internet
Author: User

Install Oracle JDK in Ubuntu Linux

Note: Since many systems do not support OpenJDK, you need to install Oracle JDK In Ubuntu. The Oracle JDK installation does not seem to provide the apt method, so the installation of Oracle JDK is relatively troublesome. I often install it. To make it easier for others to view it at the same time, write it down.

Step 1: differentiate between 32-bit and 64-bit operating systems
First, determine whether your ubuntu linux is 32-bit or 64-bit. There are many methods. Here we will introduce one.
$ Uname-

Step 2: uninstall OpenJDK
Run the following command to check whether OpenJDK is installed. If OpenJDK is installed, the java information is displayed.
$ Java-version

If OpenJDK is installed, You can uninstall it as follows:
$ Sudo apt-get purge openjdk -\*

Step 3: Download the Oracle JDK version
Note: Oracle 1.6 64-bit is used as an example.
Go to Development "Java SE Development Kit 6u45", and then click Accept "Accept License Agreement" on the newly opened page. Then, select "jdk-6u45-linux-x64.bin" to download. If you have not logged on, the system will go to the logon page and enter your username and password registered on the Oracle website.

Step 3: Install Oracle JDK
(1) create a java directory
$ Sudo mkdir-p/usr/local/java
Copy the jdk-6u45-linux-x64.bin you downloaded to the/usr/local/java directory
$ Cd/usr/local/java
$ Sudo cp/home/bkjia/Downloads/jdk-6u45-linux-x64.bin.

(2) decompress the binfile
$ Sudo chmod + x jdk-6u45-linux-x64.bin
$ Sudo./jdk-6u45-linux-x64.bin
$ Sudo rm-rf jdk-6u45-linux-x64.bin

Step 4: configure the JDK
(1) Configure JAVA_HOME and PATH Environment Variables
$ Sudo vi/etc/profile
Add the following parts at the end of the file:
JAVA_HOME =/usr/local/java/jdk1.6.0 _ 45
PATH = $ PATH: $ HOME/bin: $ JAVA_HOME/bin
Export JAVA_HOME
Export PATH

(2) configure the JDK and JRE of ubuntu
$ 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 as the system's 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, execute the following command to make it take effect immediately.
$./Etc/profile
Executing "java-version" again shows the following:
Bkjia @ dubuntu1404 :~ $ 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 pipeline 45-b01, mixed mode)

Install JDK 7 In Ubuntu (with Clojure download)

Install JDK 12.04 in Ubuntu

Install Oracle JDK 14.04 on Ubuntu 1.8 LTS

CentOS6.3 install JDK and environment Configuration

Install JDK 8 on Ubuntu 14.04

Install JDK graph analysis in Ubuntu

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.