Install JDK installation steps under Linux using the installation package

Source: Internet
Author: User

Install the JDK installation steps under Linux using the installation package:
1. Download the tar.gz installation package
2. Unzip the installation package
3. Configuring the Environment
4. Modify the default settings
5. Whether the test was successful

1. Download:
You can use the URL of the wget (tar.gz installation package) or download it directly and copy it directly.
2. Unzip:
Tar package compression
-C Archive File
-X Compressed file
-Z gzip Compressed file
-V shows the compression or decompression process V (view)
-F Use file name

TAR-CVF/HOME/ABC.TAR/HOME/ABC only packaged, not compressed
TAR-ZCVF/HOME/ABC.TAR.GZ/HOME/ABC packaged and compressed with gzip

-ZXVF gzip Format extract display process generate file name
-XVF non-fixed format decompression display process generate file name
-CVF non-fixed format compression display process generated file name
-ZCVF gzip format compression display process generate file name

3. Configure the environment Vim ~/.BASHRC or modify the///program file???
Java_home = JDK installation directory
/usr/lib/jvm/(unzipped jdk) JDK
CLASSPATH = ClassLoader location (where bytecode files are stored) can have multiple, middle use: separate spaces
PATH = Execution file location of the compilation run (Java Javac, etc.)
Jre_home = location of the core jar package

E:

1 export java_home=/usr/lib/jvm/2 export jre_home=${java_home}/3 Export classpath=.:${java_home}/lib:${jre_home}/4 export path=${java_home}/bin: $PATH
View Code

Execute the source ~/.BASHRC to complete the modification

4. Configure the default JDK version
For multiple versions, or JDK versions installed by default on the system

1 sudoUpdate-alternatives--Install/usr/bin/java Java/usr/lib/jvm/jdk8/bin/java - 2 sudoUpdate-alternatives--Install/usr/bin/javac Javac/usr/lib/jvm/jdk8/bin/javac - 3 sudoUpdate-alternatives--Install/usr/bin/jar Jar/usr/lib/jvm/jdk8/bin/jar - 4 sudoUpdate-alternatives--Install/usr/bin/javah Javah/usr/lib/jvm/jdk8/bin/javah - 5 sudoUpdate-alternatives--Install/USR/BIN/JAVAP JAVAP/USR/LIB/JVM/JDK8/BIN/JAVAP - 6 sudoUpdate-alternatives--config Java
View Code

Performing an update displays the JDK that is already in the system and then selects one as the default

[Email protected]:~$ sudo update-alternatives--config java
There are 3 candidates that can be used to replace Java (providing/usr/bin/java).


Select Path Priority state
------------------------------------------------------------
* 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 Auto mode
1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 Manual Mode
2/usr/lib/jvm/java-6-sun/jre/bin/java 63 Manual Mode
3/usr/lib/jvm/java-7-sun/bin/java 300 Manual Mode


To maintain the current value [*] press ENTER, or type the number of your choice: 3
Update-alternatives: Use/usr/lib/jvm/java-7-sun/bin/java to provide/usr/bin/java (Java) in manual mode.

5. Use Java-version to view

6.which Javac View the path to the default installation JDK


Install JDK installation steps under Linux using the installation package

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.