Version control Java with SDKMAN

background

It seems that Oracle Java has also been paid for commercial use, and it was troublesome to install it with GUI, so I thought that I would like to be able to version control Java with CLI like nodenv of JavaScript.

Is there a Java version control tool like xxxenv?

There was something called jenv. However, it seems that Java itself needs to be installed by itself, and jenv seems to be positioned as a version switching tool.

It would be nice to be able to install and switch versions like nodenv.

SDKMAN

When I searched for something that could be installed and switched versions, I found SDKMAN. I installed it referring to the following. #Java: vol1: [java / JDK version control best practice]

By the way, this time I tried to install Java 8 of Adopt OpenJDK, but there are two in list.

% sdk list java

It seems that the JVM is different when I look it up. Download and install AdoptOpenJDK

j9 = OpenJ9

Eclipse OpenJ9 is the JVM of the Eclipse community. An enterprise-class JVM designed for low memory usage and fast boot, used by IBM's JDK.

hs = HotSpot

HotSpot is the JVM of the OpenJDK community. It is currently the most widely used JVM and is used by Oracle's JDK.

It seems to mean that, so this time I tried to use the same hs as the conventional Oracle. (I wonder if OpenJ9 is more for the enterprise and has more functionality. Is this better in the future?)

Uninstall Oracle Java

I think I was able to refer to this. .. .. (faint memory) How to uninstall Java on Mac

After uninstalling Oracle Java, the example dialog is displayed!

To use the " java "command line tool every time you start IntelliJ IDEA, you need to install the JDK. A dialog like sdkman` continued to be displayed even after Java was installed.

The workaround is that the dialog no longer appears with File> Invalidate Caches / Restart. JDKs installed with SDKMAN are not selectable in the IntelliJ IDE

Verification

% java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)

I was also able to run a traditional Java project in IntelliJ IDEA. It seems to be okay for the time being.

Future tasks

If you think that the Android development environment has been migrated with this, it seems that the JDK is included in Android Studio. What is this guy really? I would like to think about Android when it is needed again.

/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/java -version
openjdk version "1.8.0_242-release"
OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
OpenJDK 64-Bit Server VM (build 25.242-b3-6222593, mixed mode)

Recommended Posts

Version control Java with SDKMAN
Java version control with jenv
Java version control with jenv on OSX
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 version control using cask + anyenv + jenv
# 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
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
Easy BDD with (Java) Spectrum?
Learning Java framework # 1 (Mac version)
Use Lambda Layers with Java
Java multi-project creation with Gradle
Getting Started with Java Collection
Java version 8 and later features
Java Config with Spring MVC
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
Rewrite Java try-catch with Optional
[Java] Multi-thread processing --Exclusive control
Install Java 7 with Homebrew (cask)
Java to play with Function
Try DB connection with Java
Enable Java EE with NetBeans 9
Try gRPC with Java, Maven
RSA encryption / decryption with java 8
Paging PDF with Java + PDFBox.jar
Sort strings functionally with java
Object-oriented (java) with Strike Gundam
Use SDKMAN! With Git Bash
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
Error when playing with java
Using Mapper with Java (Spring)
Java study memo 2 with Progate