First
brew install jenv
Install with. next
echo 'export PATH="$HONE/.jenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
Put it in the PATH.
If you are installing the latest version (java10 as of August 2018)
brew cask install java
It is possible with. However, this time I will install it to start Digdag, so I want to select java8
brew cask install java8
Very much
Error: Cask 'java8' is unavailable: No Cask with this name exists.
I get an error and cannot install. For the time being, you can install brew by the following method, but this time, from Oracle official Download the dmg of se8 kit and install it (I used "jdk-8u181-macosx-x64.dmg" for this installation) (Zulu is an open source certified build of OpenJDK that fully complies with Azul's open source Java SE standard)
brew cask install caskroom/versions/zulu8
When you start the installer, you don't have to change the settings and the installation will be completed immediately. when finished
$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
If you check the version like this, you can see that java8 is installed.
Find out the path of the JVM Home to add to the management with the jenv add command
~$ /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
1.8.0_181, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
So copy the part of "/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home"
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
As you check with jenv versions
* system (set by ....)
1.8
1.8.0.181
oracle64-1.8.0.181
After that, you can set your favorite version of java with commands such as jenv global and jenv local each time.
Recommended Posts