Java version control with jenv

Java version control with jenv

Introduction

Currently (April 17, 2019) the latest version of java is 12.

environment

Install jenv

$ brew install jenv

Add the following to .bash_profile and pass it through the path.

#Pass through jenv's PATH
export JENV_ROOT="$HOME/.jenv"
if [ -d "${JENV_ROOT}" ]; then
  export PATH="$JENV_ROOT/bin:$PATH"
  eval "$(jenv init -)"
fi

JDK installation

There is also a method to install with brew cask, but in the current environment it was not possible to install from brew, so install from Oracle.

Install from here

I installed 12,10,8 this time, so I will explain it on that assumption.

$ /usr/libexec/java_home -V

When you run the above command, the installed JDK versions will be listed.

In my case, the command is executed and returned as follows.

12, x86_64:	"Java SE 12"	/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home
10.0.2, x86_64:	"Java SE 10.0.2"	/Library/Java/JavaVirtualMachines/jdk10.0.2.jdk/Contents/Home
1.8.0_202, x86_64:	"Java SE 8"/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home

You will need the part displayed as /Library… jdk-12.jdk / Contents / Home later. ・

$ jenv add /Library...jdk-12.jdl/Contents/Home

Enter the above part after `jenv add` like, and register it in jenv.

$ jenv versions

The java version registered in jenv is displayed in a list with the command of.

Change Java version of Global

$ jenv global 12
$ jenv rehash #May not be needed

$jenv gobal [version]After the

$jenv rehashIn my case, the version did not switch.

Change Java version of Local

$ jenv local 12

$jenv local [version]Change with

Whether it can be changed

java -version

So, check it, and if the changes are reflected, it's okay! !!

Recommended Posts

Java version control with jenv
Java version control with jenv on OSX
Version control Java with SDKMAN
Java version control using cask + anyenv + jenv
Java version control on macOS
Version control CocoaPods with Docker
Java control syntax
Add index with Java8 Stream.map (tuple version)
Java control syntax
Java version check
# Java: vol1: [java / JDK version control best practice]
Java installation (Mac, Homebrew, multiple version control)
[LeJOS] Let's control the EV3 motor with Java
Install java with Homebrew
[Java] Convert PDF version
Change seats with java
Install Java with Ansible
Java version notation comparison
[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
[LeJOS] Let's remotely control the EV3 motor with Java
Use java1.7 (zulu7) under a specific directory with jenv
Learning Java framework # 1 (Mac version)
Java multi-project creation with Gradle
Getting Started with Java Collection
Java version 8 and later features
How to lower java version
Basic Authentication with Java 11 HttpClient
Let's experiment with Java inlining
Ruby version switching with rbenv
Run batch with docker-compose with Java batch
[Template] MySQL connection with Java
Rewrite Java try-catch with Optional
[Java] Multi-thread processing --Exclusive control
Install Java 7 with Homebrew (cask)
[Java] JSON communication with jackson
Java to play with Function
Try DB connection with Java
Enable Java EE with NetBeans 9
[Java] JavaConfig with Static InnerClass
Try gRPC with Java, Maven
Let's operate Excel with Java! !!
Using multiple versions of Java with Brew on Mac + jEnv
RSA encryption / decryption with java 8
Paging PDF with Java + PDFBox.jar
Sort strings functionally with java
Object-oriented (java) with Strike Gundam
Control log output with Doma2
[Java] Content acquisition with HttpCliient
Troubleshooting with Java Flight Recorder
Streamline Java testing with Spock
Connect to DB with Java
Connect to MySQL 8 with Java
☾ Java / Iterative statement and iterative control statement