Java version switching in Ubuntu

Source: Internet
Author: User

Because we need to compile 2.1 and 2.3 copies in the same Ubuntu EnvironmentCodeAnd the Java version they use is 1.5, and the other is 1.6, so you need to switch before compiling;

The switchover method is simple. Use the following two commands:

 
Update-alternatives -- config Java
Update-alternatives -- config javac

For example:

Root @ desktop-Ubuntu :~ # Update-alternatives -- config Java
There are 2 choices for the alternative Java (providing/usr/bin/Java ).

Select the path priority status
------------------------------------------------------------
* 0/usr/lib/JVM/Java-6-sun/JRE/bin/Java 63 automatic mode
1/usr/lib/JVM/Java-1.5.0-sun/JRE/bin/Java 53 manual mode
2/usr/lib/JVM/Java-6-sun/JRE/bin/Java 63 manual mode

To maintain the current value [*], press the Enter key or enter the selected number: 1.
Update-Alternatives:/usr/lib/JVM/Java-1.5.0-sun/JRE/bin/Java is used to provide/usr/bin/Java (Java) in manual mode.

You only need to enter the desired number and press Enter. If you do not change the number, press enter directly. Do not forget to change the value of javac ~

After modification,

Java-version

Javac-version to confirm ~

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.