Ubuntu How to install switch JDK version

Source: Internet
Author: User

There is always some version incompatibility when configuring the Java JDK, so let's talk about how to switch the JDK version.

My system comes with a JDK that is 1.6 execution java-version


1.JDK Installation

You can first use the command to install the JDK directly

sudo apt-get install Openjdk-7-jre openjdk-7-jdk.
You can also download the installation package post-pass command installation

TAR-ZXVF jdk-7u10-linux-i586.tar.gz
2. Add JDK:
Update-alternatives--install/usr/bin/java Java/usr/lib/jvm/java/jdk1.7.0_10/bin/java 300update-alternatives-- Install/usr/bin/javac Javac/usr/lib/jvm/java/jdk1.7.0_10/bin/javac 300 Note: The JDK1.7.0_10 version is subject to change

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

sudo update-alternatives--config javasudo update-alternatives--config Javac

The results are as follows


Select serial number, enter can;

4. Then java-version,javac-version view the current JDK version



Ubuntu How to install switch JDK version

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.