JDK version switching under Linux

Source: Internet
Author: User

Installation in the ubuntu10.10 system, the development environment needs, sometimes need to install JDK5 and JDK6, how to achieve the switch between the two? Use the Update-alternativs command to complete this task

Specific as follows:

1. Check to see if the JDK is in the Ubuntu JDK menu:

Java code
    1. Update-alternatives--config Java
    2. Update-alternatives--config Javac

2. If not in the menu can be added as follows:

Java code
    1. Update-alternatives--install/usr/bin/java Java/usr/lib/jvm/java/jdk1. 6.0_12/bin/java
    2. Update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/java/jdk1. 6.0_12/bin/javac


Note: Different versions of Jdk1.6.0_12 are subject to change

3.sudo Update-alternatives--config Java

Java code
    1. sudo update-alternatives--config javac


Select serial number, enter can;
4. Then java-version,javac-version view the current JDK version

JDK version switching under Linux

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.