Ubuntu Installation JDK 7

Source: Internet
Author: User

Download the JDK Compression pack installation directly

Divided into the following 5 steps

1. Download the JDK on the website

2. Unzip and drop to the specified directory

3. Configure Environment variables

4. Set the system default JDK

5. Test the JDK

1. Download JDK Address: http://www.oracle.com/technetwork/articles/javase/index-jsp-138363.html

Select the appropriate. gz package to download

2. Unzip and place in the specified directory (take jdk-7u60-linux-x64.gz as an example)

To create a directory:

sudo MKDIR/USR/LIB/JVM

Add compression to the directory:

sudo tar-zxvf jdk-7u60-linux-x64.gz-c/USR/LIB/JVM
3. Modify the Environment variables:
sudo vim ~/.BASHRC

Append the following to the end of the file:

#set Oracle JDK Environment
Export java_home=/usr/lib/jvm/jdk1.7.0_60 # # Note here to replace the directory with your own extracted JDK directory export JRE_HOME=${JAVA_HOME}/JRE export Classpath=.:${java_home}/lib:${jre_home}/lib export Path=${java_home}/bin: $PATH

Make environment variables effective immediately

SOURCE ~/.BASHRC
4. Set the system default JDK version
sudo update-alternatives--install/usr/bin/java java/usr/lib/jvm/jdk1.7.0_60/bin/java  sudo Update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_60/bin/javac  sudo Update-alternatives--install/usr/bin/jar jar/usr/lib/jvm/jdk1.7.0_60/bin/jar   sudo update-alternatives-- Install/usr/bin/javah javah/usr/lib/jvm/jdk1.7.0_60/bin/javah   sudo update-alternatives--install/usr/bin/ JAVAP JAVAP/USR/LIB/JVM/JDK1.7.0_60/BIN/JAVAP 300   

Then execute:

sudo update-alternatives--config java

If you install the JDK for the first time, you will be prompted

There is only one alternative in link Group Java (Providing/usr/bin/java):
/usr/lib/jvm/jdk1.7.0_60/bin/java

No, choose the right JDK

5. Test the JDK
Java-version

Java Version "1.7.0_60"

Java (TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot (TM) 64-bit Server VM (build 24.60-b09, Mixed mode)

JDK Installation succeeded

Ubuntu two kinds of installation Jdk7 JDK8 way to complete the introduction

Ubuntu Installation JDK 7

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.