Linux under Installation configuration JDK7

Source: Internet
Author: User

1. Download the JDK

Currently the latest JDK version is: Java SE development Kit 7u5

: http://download.oracle.com/otn-pub/java/jdk/7u5-b06/jdk-7u5-linux-i586.tar.gz

Check Latest: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Unzip the installation

We install the JDK to this path:/USR/LIB/JVM
If there is no such directory (the first time of course not), we will create a new directory

0 S CD / usr / lib sudo mkdir JVM

After the establishment of the good, we came to the download of the compressed package directory, extracted to our newly created folder inside, and modify the name to facilitate our management

1 2 3 sudo  Tar  ZXVF . / JDK - 7 - linux - i586 . Tar . GZ - C / usr / lib / JVM cd / C25>USR / lib / JVM sudo mv jdk1 c33>. 7.0_05  / Jdk7
3. Configure Environment variables
1 gedit ~ / . BASHRC

Add at the end of the open file

1 2 3 4 export   java_home = / usr / Lib / JVM / Jdk7 export   jre_home = $ { java_home } / JRE export   CLASSPATH = . : $ { java_home } / Lib : $ { jre_home } / Lib export   PATH = $ { java_home } / bin : $ PATH

Save the exit and enter the following command to make it effective

1 Source ~ / . BASHRC
4. Configure the default JDK (this step can be omitted in general)

Some Linux distributions already have default JDK, such as OPENJDK. So in order to make the JDK version we just installed can be the default JDK version, we will also make the following configuration.
Execute the following command:

1 2 sudoUpdate - Alternatives-- Install / usr / bin / JavaJava/ usr / Lib / JVM / Jdk7 / bin / Java - sudoUpdate - Alternatives-- Install/ usr / bin / JavacJavac/ usr / Lib / JVM / Jdk7 / bin / Javac -

Note: If the above two commands do not find a path problem, just restart the computer and repeat the above two lines of code is OK.

Execute the following code to see the current various JDK versions and configurations:

1 sudo Update - Alternatives -- Config Java
5. Testing

Open a terminal and enter the following command:

1 Java - version

Show Results:

1 2 3 Java  version "1.7.0_05" Java  ( TM )  SE  Runtime  Environment ( build 1.7.0_05 - b05 )  Java HotSpot  ( TM )  Server  VMs ( build 23.1 - b03 , mixed Mode )

This means that the Java command is ready to run.

Installing configuration JDK7 under Linux

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.