What is jenv?

jenv is Java environment manager, and it is a clone of RVM for Java. jenv can manage parallel versions of Java development kits on any Unix based system. It provides a convenient command line interface for installing, switching, removing and listing Candidates.

Why jenv?

Install jenv on Linux or Mac

Open your favourite terminal and enter the following command:

$ curl -L -s get.jenv.io | bash

Install jenv on Windows

jenv requires PowerShell 4.0, please install following components for Windows 7. Please ignore to install the following component if you are using Windows 8.1.

After required components installed, and open PowerShell as administrator and execute the following command:

PS> set-executionpolicy remotesigned

Open Powershell as login user and install jenv:

PS> (new-object Net.WebClient).DownloadString("http://get.jenv.io/GetJenv.ps1") | iex

Install Java

Because I can not redistribute Java SDK, so you should download it from http://www.oracle.com/technetwork/java/javase/downloads/index.html and install. After install please execute following command:

$ mkdir -p $HOME/.jenv/candidates/java
$ ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/home $HOME/.jenv/candidates/java/1.8.0_71
$ jenv default java 1.8.0_71

Install candidates

First view all available candidates:

$ jenv all
Second list available version for the candidate, such as Maven candidate:
 $ jenv list maven
Final install the candidate with the version:
$ jenv install maven 3.3.9
In your terminal, input mvn --version to check the installation.

Install candidates in other ways

Install from local folder:

$ jenv install java 1.8.0_71 /user/local/jdk-1.8.0_71
Install from git repository:
 $ jenv install spike 0.0.1 git@github.com:linux-china/groovy_scripts.git

How to sync candidates information with the repository

jenv stores the repository information with offline mode, please use following command to update repository information.

$ jenv repo update

How to update jenv

Please use selfupdate command to get last version.

$ jenv selfupdate

jenvrc support

jenvrc is jenv setup file which contains candidate and the version as following:

java=1.8.0_71
maven=3.3.9
After you enter this directory, jenv will setup environment automatically.

jenv IntelliJ IDEA plugin

With jenv IDEA plugin, you don't need to setup Java SDK, Maven, and so on, and jenv IDEA plugin can scan jenv directory and setup the settings in IDEA automatically. Please visit http://plugins.jetbrains.com/plugin/?idea&pluginId=7229 for more information.

Keep in touch