Java version control with jenv on OSX

Install jenv

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.

Java installation

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.

Add java to be managed by jenv

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

Java version control with jenv on OSX
Java version control with jenv
Java version control on macOS
Version control Java with SDKMAN
Java version control using cask + anyenv + jenv
Version control CocoaPods with Docker
Java version change on CentOS
Using multiple versions of Java with Brew on Mac + jEnv
Using Java on OSX 10.15 (Catalina) β
Install Java with zip on Windows
Notes on signal control in Java
How to switch Java version with direnv in terminal on Mac
Add index with Java8 Stream.map (tuple version)
Using JupyterLab + Java with WSL on Windows 10
Install Java8 with Yum on Amazon Linux
Build OpenCV with Java Wrapper on Ubuntu 18.04
# Java: vol1: [java / JDK version control best practice]
Java installation (Mac, Homebrew, multiple version control)
Java control syntax
Java control syntax
[LeJOS] Let's control the EV3 motor with Java
Easily switch Java versions with alias on macOS
Install Java 11 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Java version check
Run Edge (Chromium version) on Mac with Selenium
Install Java 14 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 8 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Using Java 8 with Bluemix (on Liberty Runtime & DevOps Service)
Build Java development environment with VS Code on Mac
Java development environment construction on Mac-JDK Install (2020 preservation version)
Compile with Java 6 and test with Java 11 while running Maven on Java 8
Install Java 8 (OpenJDK: Amazon Corretto) on macOS with Homebrew
Display characters on I2C 1602 LCD with Raspberry Pi 3 & Java
Install Java 8 (OpenJDK: Zulu Community) on macOS with Homebrew
[LeJOS] Let's remotely control the EV3 motor with Java
Run kuromoji on Win10 + Eclipse + Java environment (January 2020 version)
Use java1.7 (zulu7) under a specific directory with jenv
Let's touch on Java
Install Java on Mac
Change seats with java
Install Java with Ansible
Java version notation comparison
Run PostgreSQL on Java
[Java] Control syntax notes
Comfortable download with JAVA
Switch java with direnv
Switching java version (memorial)
Download Java with Ansible
[Rails version control] rails version downgrade
Let's scrape with Java! !!
Build Java with Wercker
Endian conversion with JAVA
Regularly post imaged tweets on Twitter with AWS Lambda + Java
A memo to start Java programming with VS Code (2020-04 version)
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.