Use alternatives for java version Conversion

Source: Internet
Author: User
Use alternatives to convert the java version-general Linux technology-Linux programming and kernel information. The following is a detailed description. After jdk was installed, java and javac were replaced with the java and javac of gij in/usr/bin.

Some people on the Internet said that they could use a tool named alternativs to migrate the software version in linux. They decided to use alternatives to migrate the jdk from gij to my newly installed jdk6.0.

Alternatives is in the/usr/sbin directory.

First, add the newly installed jdk to alternatives:

[Root @ djn-laptop sbin] #./alternatives -- install/usr/bin/java/usr/share/jdk1.6.0 _ 02/bin/java 300
[Root @ djn-laptop sbin] #./alternatives -- install/usr/bin/javac/usr/share/jdk1.6.0 _ 02/bin/javac 300

Then, use the -- display option to view the available JDK of the current system:

[Root @ djn-laptop sbin] #./alternatives -- display java
Java-the status is manual.
The link currently points to/usr/share/jdk1.6.0 _ 02/bin/java
/Usr/lib/jvm/jre-1.4.2-gcj/bin/java-1420 priority
From the keytool:/usr/lib/jvm/jre-1.4.2-gcj/bin/keytool
From rmiregistry:/usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
From jre_exports:/usr/lib/jvm-exports/jre-1.4.2-gcj
From jre:/usr/lib/jvm/jre-1.4.2-gcj
/Usr/share/jdk1.6.0 _ 02/bin/java-300 priority
From keytool :( null)
From rmiregistry :( null)
From jre_exports :( null)
From jre :( null)

Currently, the "best" version is/usr/lib/jvm/jre-1.4.2-gcj/bin/java.

[Root @ djn-laptop sbin] #./alternatives -- display javac
Javac-the status is manual.
The link currently points to/usr/share/jdk1.6.0 _ 02/bin/javac
/Usr/lib/jvm/java-1.4.2-gcj/bin/javac-1420 priority
Appletviewer:/usr/lib/jvm/java-1.4.2-gcj/bin/appletviewer
From jar:/usr/lib/jvm/java-1.4.2-gcj/bin/jar
From jarsigner:/usr/lib/jvm/java-1.4.2-gcj/bin/jarsigner
From javadoc:/usr/lib/jvm/java-1.4.2-gcj/bin/javadoc
From javah:/usr/lib/jvm/java-1.4.2-gcj/bin/javah
From rmic:/usr/lib/jvm/java-1.4.2-gcj/bin/rmic
From java_sdk_exports:/usr/lib/jvm-exports/java-1.4.2-gcj
From java_sdk:/usr/lib/jvm/java-1.4.2-gcj
/Usr/share/jdk1.6.0 _ 02/bin/javac-300 priority
From appletviewer :( null)
From jar :( null)
From jarsigner :( null)
From javadoc :( null)
From javah :( null)
From rmic :( null)
From java_sdk_exports :( null)
From java_sdk :( null)

The current "best" version is/usr/lib/jvm/java-1.4.2-gcj/bin/javac.

After confirmation, you can use the -- config parameter to select the JDK you want to use:

[Root @ djn-laptop sbin] #./alternatives -- config java

There are two programs that provide "java ".

Select command
-----------------------------------------------
* 1/usr/lib/jvm/jre-1.4.2-gcj/bin/java
+ 2/usr/share/jdk1.6.0 _ 02/bin/java

Press Enter to save the current selection [+], or type the selection Number:

[Root @ djn-laptop sbin] #./alternatives -- config javac

A total of two programs provide "javac ".

Select command
-----------------------------------------------
* 1/usr/lib/jvm/java-1.4.2-gcj/bin/javac
+ 2/usr/share/jdk1.6.0 _ 02/bin/javac

Press Enter to save the current selection [+], or type the selection Number:

Enter the JDK number. Of course, I chose the second option.
Related Article

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.