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.
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
8.0.252.j9-adpt
8.0.252.hs-adpt
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?)
I think I was able to refer to this. .. .. (faint memory) How to uninstall Java on Mac
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
% 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.
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