"Go" Ubuntu configuration Java jdk1.8 Environment, add multi-version JDK and switch method

Source: Internet
Author: User

First, install Java jdk1.8

1. Add a software source

sudo add-apt-repository Ppa:webupd8team/java

2. Update the SOFTWARE source

sudo apt-get update

3. Installing jdk1.8

sudo apt-get install Oracle-java8-installer

The installer will prompt you to agree to Oracle's terms of service, select OK

Then select Yes to

Second, check the Java installation path

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

Third, view the Java version

Java-version

PS: Update jdk1.7 to jdk1.8 directly perform the installation of the first step overlay on OK.

Iv. Adding multiple versions of the JDK and switching methods (install JDK 6 or 7)

1. Installing Jdk6 and Jdk7

Installing JDK 6

sudo apt-get install Oracle-java6-installer

Installing JDK7

sudo apt-get install Oracle-java7-installer

2. View all JDK installation versions

sudo update-java-alternatives-ljava-6-oracle 3/usr/lib/jvm/java-6-oraclejava-7-oracle 4/usr/lib /jvm/java-7-Oraclejava-8-oracle 2/usr/lib/jvm/java-8-oracle

3. The-s parameter makes it easy to switch to other Java versions

$ sudo update-java-alternatives-s java-6-oracle

Or

$ sudo update-java-alternatives-s java-7-oracle

Or

$ sudo update-java-alternatives-s java-8-oracle

View the Java JKD version again

Java-"1.6.0_45"1.6.0_45-64-bit Server VM (build 20.45-b01, Mixed mode)

Note: Before installing JDK8 by decompressing the configuration environment variable, you cannot switch the JDK using the sudo update-java-alternatives-s command, using sudo update-alternatives-config Java version is selected Java version, although the Java edition changed, but the Javac, Javah, jar and other file path is Openjdk7,

If you want to always, you have to map the file one by one, by practice, that method is unreliable. With the above method, the installation of multiple JDK, do not need to configure environment variables, by switching commands, you can achieve the purpose.

In addition the Ubuntu installs OPENJDK7 commands:

sudo apt-get install OPENJDK-7-JDK

To view the installation path for OPENJDK:

Dpkg-l OPENJDK-7-JDK

Original: http://blog.csdn.net/hanshileiai/article/details/46968275

"Go" Ubuntu configuration Java jdk1.8 Environment, add multi-version JDK and switch method

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.