Install Java 11 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew

This environment

Installation

Install according to the official document. GitHub - AdoptOpenJDK/homebrew-openjdk: AdoptOpenJDK HomeBrew Tap

$ brew tap AdoptOpenJDK/openjdk
$ brew cask install adoptopenjdk11

Check the location of the installed directory with the java_home command

$ /usr/libexec/java_home -v 11
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

Set the environment variables JAVA_HOME and PATH

Describe it in .bash_profile or .bashrc as needed.

export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
PATH=${JAVA_HOME}/bin:${PATH}

Check the installed AdoptOpenJDK

$ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)

$ javac -version
javac 11.0.6

$ which java
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java

$ which javac
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/javac

$ ls /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/
jaotc		javap		jfr		jmap		jstat		rmiregistry
jar		jcmd		jhsdb		jmod		jstatd		serialver
jarsigner	jconsole	jimage		jps		keytool		unpack200
java		jdb		jinfo		jrunscript	pack200
javac		jdeprscan	jjs		jshell		rmic
javadoc		jdeps		jlink		jstack		rmid

Recommended Posts

Install Java 11 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 14 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 8 (OpenJDK: AdoptOpenJDK) on macOS with Homebrew
Install Java 8 (OpenJDK: Amazon Corretto) on macOS with Homebrew
Install Java 8 (OpenJDK: Zulu Community) on macOS with Homebrew
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.
Install java with Homebrew
Install OpenJDK on macOS
Install OpenJDK7 (JAVA) on ubuntu 14.04
Install Java 7 with Homebrew (cask)
Install Java with zip on Windows
Install OpenJDK (Java) on the latest Ubuntu
Install Java8 with Yum on Amazon Linux
Install java and android-sdk on Mac using homebrew
Install Java on Mac
Install Java with Ansible
Install OpenJDK8 with RPM
Easily switch Java versions with alias on macOS
Install openjdk11 on mac
Install Homebrew on Ubuntu 20.04
Install OpenJDK 8 on mac
Install Ruby 3.0.0-preview1 on macOS (also without Homebrew ruby-build)
Install Java on WSL Ubuntu 18.04
Install Rails on macOS Catalina
Install java 1.8.0 on Amazon linux2
Install openjdk8 on Docker image (Debian)
Install Ruby on MSYS2 with pacman
Install java with Ubuntu 16.04 based Docker
Install Java Open JDK 8 on CentOS 7
Install and configure jenv on macOS
Install ruby on Ubuntu 20.04 with rbenv
Install Java 9 on windows 10 and CentOS 7
Install Java development environment on Mac
How to install Adopt OpenJDK on Debian, Ubuntu with apt (-get)
If you can't install java on Catalina
Install imagick on macOS Catalina + php 7.4 Note
Using JupyterLab + Java with WSL on Windows 10
Install Docker Desktop for Mac with Homebrew
Java version control with jenv on OSX
Build OpenCV with Java Wrapper on Ubuntu 18.04
Install NextCloud on CentOS 7 with Alibaba Cloud ECS
Note Book: OpenCV with CUDA Install On Windows10
Install GitLab on CentOS 8 with no internet connection
Install Java, Apache, Tomcat9 on EC2 (Amazon Linux2)
Switch versions with alternatives after yum install java
Introducing Eclipse IoT-Part2: Install Eclipse Neon.2 on macOS Sierra
Downgrade Java MacOS
Build Java development environment with VS Code on Mac
Compile with Java 6 and test with Java 11 while running Maven on Java 8
Install java and maven using brew on new mac
Display characters on I2C 1602 LCD with Raspberry Pi 3 & Java
Install rbenv with apt on ubuntu and put ruby
I struggled with pip install on an M1 Mac
Correspondence when Java application exed by launch4j does not work on windows with openJDK installed