Install java with Homebrew

Introduction

--This is a procedure memo to install java using Homebrew on Mac. --I am using Sierra (10.12.2). --It is assumed that no version of java is installed at this time.

java installation procedure

1. Update brew
$ brew update
2. brew error checking
$ brew doctor
3. java installation
$ brew cask install java
4. Java version check
$ /usr/libexec/java_home -V

Execution result

Matching Java Virtual Machines (1):
    9.0.4, x86_64:	"Java SE 9.0.4"	/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
5. Pass through PATH

If bash_profile does not exist, create it.

$ touch ~/.bash_profile

Open bash_profile with an editor and add as follows. Please note that the PATH varies depending on the environment ...

export PATH=$PATH:/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home

Reflect the update of bash_profile with the source command.

$ source ~/.bash_profile

Do the following and verify that you see the directory you just added.

$ echo $PATH
$ echo $JAVA_HOME

Reference article

Install java8 on mac Learn the meaning of "passing the PATH" by building a Java development environment on Mac

Recommended Posts

Install java with Homebrew
Install Java 7 with Homebrew (cask)
Install Java with Ansible
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
Install java with Ubuntu 16.04 based Docker
Install Java and Tomcat with Ansible
Install Java with zip on Windows
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.
Install Docker Desktop for Mac with Homebrew
Install Java8 with Yum on Amazon Linux
Install Ruby 3.0.0 with asdf
Install java and android-sdk on Mac using homebrew
Install Java on Mac
Change seats with java
[Java] Install Amazon Corretto 8
Install OpenJDK8 with RPM
Comfortable download with JAVA
Install Gradle with ubuntu16.04
Switch java with direnv
Download Java with Ansible
Let's scrape with Java! !!
Install Homebrew on Ubuntu 20.04
Build Java with Wercker
Switch versions with alternatives after yum install java
Install Composer with Docker
Endian conversion with JAVA
Easy BDD with (Java) Spectrum?
Use Lambda Layers with Java
Java multi-project creation with Gradle
Getting Started with Java Collection
Clogged with Express npm install
Network install CentOS 8 with Kickstart.
Java Config with Spring MVC
Install OpenJDK7 (JAVA) on ubuntu 14.04
Basic Authentication with Java 11 HttpClient
Let's experiment with Java inlining
Run batch with docker-compose with Java batch
[Template] MySQL connection with Java
Rewrite Java try-catch with Optional
[Java] JSON communication with jackson
Java to play with Function
Try DB connection with Java
Install Oracle JDK 8 with Ansible
Enable Java EE with NetBeans 9
[Java] JavaConfig with Static InnerClass
Try gRPC with Java, Maven
Let's operate Excel with Java! !!
Version control Java with SDKMAN
RSA encryption / decryption with java 8
Paging PDF with Java + PDFBox.jar
Sort strings functionally with java
Object-oriented (java) with Strike Gundam
Install Java on WSL Ubuntu 18.04
[Java] Content acquisition with HttpCliient
Java version control with jenv
Troubleshooting with Java Flight Recorder
Streamline Java testing with Spock