The java version of linux is no longer afraid.

Source: Internet
Author: User
Now the java version of the linux system is no longer afraid-general Linux technology-Linux programming and kernel information. The following is a detailed description. Source: Network

The Duty Room machine, Red Hat EL3, runs the nms developed twice, because it is from the hands of previous senior engineers and is not clear about the system configuration and software packages.

Later, when debugging, various inexplicable problems often occurred. I 'd like to learn from the software tutorial. Hey, I couldn't even open studio, and I was prompted that the java path was wrong.

Dizzy, the result is that the machine, java is really busy, there is a built-in GIJ, later installed light jdk has 1.4.2, 1.5.0, 1.6.0 three versions, I was so dizzy. The jdk path pointed to by symbolic link is empty.

However, I had to reinstall the system. This system also made me messy. It is better to try again.

After reinstall, well, the system is clean. Think about what to do if there are more jdk versions in the future.

Using alternatives, You can freely switch the jdk version of linux.
After jdk was installed, java and javac were replaced with the java and javac of gij in/usr/bin. However, it seems that this is not very "formal", such as the left-side approach.

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
Now:
[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.

Ha, that's great. The Office vnc is on the server and there is something like this:/usr/sbin/alternatives.

Man 8 alternatives. After reading it, well, it's really nice.

Ha, no matter how many jdk/jre or others are in the system in the future, you will not be afraid!

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.