Linux JDK Installation

Source: Internet
Author: User

1, download JDK (Linux version)

Official website Download: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2, create Java directory (can be ignored)

mkdir /usr/local/java

3, unzip the JDKif the download is *.tar.gz (*.tar.gz is the JDK file name)
tar -zxvf *. tar. gz
if the download is *.rpm (*.rpm is the JDK file name)
Rpm2cpio *.rpm | Cpio-div
4. Unpack the jar package (jdk1.7.0_79 is the JDK directory)in the jdk1.7.0_79/lib/directory and the jdk1.7.0_79/jre/lib/directory, there are tools.pack and rt.pack files that need to be decompressed to Tools.jar and Rt.jar (requires root user action)1, switch root user (need to enter a password, if not previously used root account, you need to set the password, set the password method to search by themselves)
su root
2, Unzip (enter the Jdk1.7.0_79/jre/bin directory, enter the following command)
unpack200. /lib/rt.pack. /lib/rt.jarunpack200. /.. /lib/tools.pack. /.. /lib/tools.jar

5, explain the pressure of the JDK copied to the 2nd step in the new directory (jdk1.7.0_79 is the JDK directory)
CP -R JDK1. 7. 0_79/usr/local/java/

The PS:JDK directory is not the directory that is extracted directly, but the directory in the Usr/java of the extracted directory.

 6, adding environment variables1. Open profile file
sudo gedit/etc/profile
2, add the following at the bottom
1 java_home=/usr/local/java/jdk1. 7 . 0_79 2 path= $JAVA _home/bin: $JAVA _home/jre/Bin: $PATH3 classpath=.: $JAVA _home/lib: $JAVA _home /jre/Lib4export java_home5exportPATH6 Export CLASSPATH
3, the variable takes effect, after saving and exiting the profile file, enter
Source/etc/profile
 7. Detection (Enter the following command)
Java-version

Print out JDK version information, install correctly

Linux JDK Installation

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.