Addendum 2018-10-16 As soon as I wrote it, this article seems to be unnecessary. When Amazon Corretto announced the other day comes out! If you look at the download page for Corretto 8 which is currently in preview, the mac version is available as a pkg file! This is a great possibility of pkg even in Corretta 11! There is a great possibility that the installer will do various things and you will be comfortable from the beginning! It may be. Corretto 11 will be available after thorough testing until April next year, so if you can't wait until then, please try it.
--In the old days, those who have used the JDK of Oracle after Apple --For those who want to use it without setting jshell or troublesome paths
--Happy that the path is in the tools of the JDK.
Just install it once with the dmg package of OracleJDK 11, uninstall it, and then install OpenJDK 11 [^ 1]. If the number of tools increases after 12 in the future, it is good to follow the same procedure with the upgraded version.
-From Java SE Development Kit 11 Downloads for mac Download the JDK with the extension .dmg. --Mount the dmg file, execute the pkg file inside, and complete the next on the installer screen.
Do exactly what is in here
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Oracle/Java
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
--Download OpenJDK 11 from the highly recommended AdoptOpenJDK. I like the choice of Hotspot or OpenJ9 [^ 3]. --Double-click to expand from Finder --In the terminal, move the extracted folder [^ 2] to the location where the Oracle JDK was.
sudo mv ~/Downloads/jdk-11.0.1+13 /Library/Java/JavaVirtualMachines/
--If there are multiple JDKs in .bashrc or .zshrc, java_home will return the latest, so modify it as follows.
export JAVA_HOME=$(/usr/libexec/java_home)
It seems that the pkg installer of Oracle JDK installed first creates a link such as / usr / bin / jshell, so it is better than simply installing OpenJDK.
By the way, it seems that the latest JDK is automatically selected for the desktop regardless of the terminal settings. I was a little worried that when I installed eclipse-201809 with Oracle Java, all versions in / Library / Java / JavaVirtualMachines / were displayed in Installed JRE, but for some reason I changed to OpenJDK, only jdk-9. It disappeared and I had to manually insert others. I wonder if there was something around ~ / Library / Application \ Support / Oracle / Java. I don't know if I erased it already.
[^ 1]: To tell the truth, ** "Please prepare an OpenJDK package installer that automatically sets up like Oracle JDK" **. [^ 2]: If the version is up, please read and execute as appropriate. [^ 3]: I chose Hotspot because I imagined that there would be little discrepancy with Oracle JDK, but if you want to use eclipse, OpenJ9 may be better. I don't know.
Recommended Posts