Linux Java Version Management tool JENV usage Introduction

Source: Internet
Author: User

Different projects use different versions of Java, each time you need to manually modify the Java environment variables, it is extremely troublesome.

Jenv can manage Java versions and easily manage multiple Java issues.

First, download jenv

$ git clone https://github.com/gcuisinier/jenv.git ~/.jenv

Second, the environment variables to be included

Echo ' export path= "$HOME/.jenv/bin: $PATH" ' >> ~/.bash_profile

Third, execute the JENV init-command, so that each bash terminal can be opened to invoke the Jenv command, and the default execution of the JENV init-command.

Echo ' eval "$ (jenv init-)" ' >> ~/.bash_profile

Iv. viewing the current Java version, the output is 1.8.0_44

$ java-version

V. Locate the folder path for jdk1.8 and jdk1.7, and add to the JENV Management library:

$ jenv add/opt/java/jdk1. 8  /opt/java/jdk1. 7. 0_80

Vi. viewing Java versions that have been added

$ jenv Versions

Seven, configure the JVM to be used. There are three ways: global: By Overall, lacal: by directory, Shell:shell

$ jenv Global jdk1.7.0_80

Or

$ jenv Local jdk1.7.0_80

Or

$ jenv Shell jdk1.7.0_80

Eight, view the current Java version. The discovery version has become jdk1.7.0_80.

$ java-version

At this point, no longer have to manually modify the environment variables to change the Java version.

Linux Java Version Management tool JENV usage Introduction

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.