CentOS Set the default JDK steps and commands _linux

Source: Internet
Author: User

Set default JDK under CentOS

Recently in the Linux, with the Yum source installed Opnjdk-devel version, with the command Ll/etc/alternatives/java view, found to point to the JRE directory, rather than JDK, this setting points to the JDK directory.

Set default JDK under CentOS

To execute a command:

[Root@exkpicture ~]# Alternatives–install/usr/bin/java Java/usr/java/jdk1.7.0/bin/java 2

Note: Alternatives's grammar look here

To execute a command:

[Root@exkpicture ~]# Alternatives--config java

Select the default JDK, where "+" is the default JDK

*+ 1/usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2/usr/java/jdk1.7.0/bin/java

2. Configure Java Environment settings

[Root@exkpicture ~]# Vim/etc/profile

Add the following at the end of the file:

Export java_home=/usr/java/jdk1.7.0
export jre_home= $JAVA _home/jre
export path= $PATH: $JAVA _home/bin
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

After saving exit

Source/etc/profie

This deployment is complete.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.