Install Tomcat on centos and switch the JDK Method

Source: Internet
Author: User

After centos is installed, openjdk is used by default. We found that the image of the app verification code we developed is displayed incorrectly. We checked that the image interface is different from that of Sun JDK, we usually use Sun JDK for development in windows. Therefore, we must replace Sun JDK. Generally, we may need to delete open JDK. I checked it online and found a new method, use alternatives to convert the Java version. The specific method is as follows:

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

/Usr/share/jdk1.6.0 _ 02/bin/Java is the Sun JDK directory we installed. It depends on the directory you installed.

Then, use the -- display option to view the available JDK of the current system:
[Root @ djn-laptop sbin] #./alternatives -- display Java

 

Then you can use the -- config parameter to select the JDK you want to use:
[Root @ djn-laptop sbin] #./alternatives -- config Java
After using this command, the JDK list is displayed,

* 1/usr/lib/JVM/java-1.4.2-gcj/bin/javac
+ 2/usr/share/jdk1.6.0 _ 02/bin/javac
Press 1 or 2 to select the JDK you want to use. After switching is complete

Use Java-version to view the specific version

 

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.