For Windows/Linux/Mac Users
1) Open Command prompt in your system
2) In Command prompt, first install the Home brew by entering the below command
$/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3) Now, Install the JEnv by entering the below command
Installation of JEnv
Enter the following code for installing JEnv
Linux / OS X
$ git clone https://github.com/jenv/jenv.git ~/.jenv
Mac OS X via Homebrew
$ brew install jenv
4) Install either Bash or Zsh by entering the following code in command prompt
Bash
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(jenv init -)"' >> ~/.bash_profile
Zsh
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(jenv init -)"' >> ~/.zshrc
5) Configure the following command in command prompt to add the Jenv file
$ jenv add /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
oracle64-1.6.0.39 added
$ jenv add /Library/Java/JavaVirtualMachines/jdk17011.jdk/Contents/Home
oracle64-1.7.0.11 added
for Mac Users
/usr/libexec/java_home/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Note: In above code, change the version according to the Installed Java version
6) To check the Installed Java version in your system enter the following code in command prompt:
$ java -version
Top comments (0)