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.
Open your favourite terminal and enter the following command:
$ curl -L -s get.jenv.io | bash
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
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
First view all available candidates:
$ jenv allSecond list available version for the candidate, such as Maven candidate:
$ jenv list mavenFinal install the candidate with the version:
$ jenv install maven 3.3.9In your terminal, input mvn --version to check the installation.
Install from local folder:
$ jenv install java 1.8.0_71 /user/local/jdk-1.8.0_71Install from git repository:
$ jenv install spike 0.0.1 email@example.com:linux-china/groovy_scripts.git
jenv stores the repository information with offline mode, please use following command to update repository information.
$ jenv repo update
Please use selfupdate command to get last version.
$ jenv selfupdate
jenvrc is jenv setup file which contains candidate and the version as following:
java=1.8.0_71 maven=3.3.9After you enter this directory, jenv will setup environment automatically.
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.