Linux installation JDK notes

Source: Internet
Author: User

First, install the JDK:

RPM Installation:

# RPM-IVH jdk-8u45-linux-x64.rpm

In the case of a Debian system, tar. Unzip tar.gz to/usr/local/java/and create the corresponding link file. Such as:

$ ll/usr/local/java/Total usage 4lrwxrwxrwx 1 root root 6 June 22:31 Default-latestdrwxr-xr-x 8 UUCP 143 4096 April 11 01:26 jdk1.8.0_45lrwxrwxrwx 1 root root 28 June 22:30 latest-/usr/local/java/jdk1.8.0_45/

Second, the configuration:

Create the/etc/profile.d/java.sh and edit the configuration file:

$ cat/etc/profile.d/java.sh Export Java_home=/usr/local/java/latestexport classpath=.: $JAVA _home/lib/dt.jar: $JAVA _ Home/lib/tools.jarexport jre_home= $JAVA _home/jreexport path= $PATH: $JAVA _home/bin


When other versions of the JDK are installed by default in the system (for example: OPENJDK), the default version needs to be changed.

To view the current binary level version:

$ update-alternatives--display Javajava-Auto mode link currently pointing to/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java/usr/lib/jvm/ Java-7-openjdk-amd64/jre/bin/java-priority 1071 Slave java.1.gz:/usr/lib/jvm/java-7-openjdk-amd64/jre/man/man1/ Java.1.gz's current "best" version is/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java. $ update-alternatives--display javacupdate-alternatives: Error: No JAVAC candidates $ update-alternatives--display Jarupdate-alternatives: Error: No jar candidate $ update-alternatives--display javahupdate-alternatives: Error: No Javah candidates $ update-a Lternatives--display javaupdate-alternatives: Error: No JAVAP candidates

Only the Java link file can be modified at this time:

$ sudo update-alternatives--install/usr/bin/java Java/usr/local/java/latest/bin/java 300

Execute again:

$ update-alternatives--display Javajava-Auto mode link currently pointing to/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java/usr/lib/jvm/ Java-7-openjdk-amd64/jre/bin/java-priority 1071 Slave java.1.gz:/usr/lib/jvm/java-7-openjdk-amd64/jre/man/man1/ Java.1.gz/usr/local/java/latest/bin/java-Priority 300 the current "best" version is/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java.

To modify the default value:

$ sudo update-alternatives --config java has  2  candidates available for replacement  java  (provides  / Usr/bin/java).    Select         paths                                              Priority     Status------------------------------------------------------------* 0             /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071        Auto Mode   1             /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071        Manual Mode   2            /usr/ Local/java/latest/bin/java                   300        Manual mode to maintain the current value [*] press ENTER, or type the number you selected:2update-alternatives:  using /usr/local/java/latest/bin/java to provide /usr/bin/java  (Java)  in  Manual mode

Check default values:

$ update-alternatives--display Javajava-Manual mode link currently pointing to/usr/local/java/latest/bin/java/usr/lib/jvm/ Java-7-openjdk-amd64/jre/bin/java-priority 1071 Slave java.1.gz:/usr/lib/jvm/java-7-openjdk-amd64/jre/man/man1/ Java.1.gz/usr/local/java/latest/bin/java-Priority 300 the current "best" version is/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java.

Verify:

$ Java-versionjava Version "1.8.0_45" Java (tm) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot (tm) 64-bit Server V M (build 25.45-b02, Mixed mode)


This article is from the "Silver Kay Blog" blog, make sure to keep this source http://yinkai.blog.51cto.com/3813923/1664067

Linux installation JDK notes

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.