How to Install Java on Mac OS

Installing Java on MacOS

We will install OpenJDK which is free and doesn't need Oracle JDK licence.

  1. Go to https://jdk.java.net/19/ and search for the JDK version.

  2. Download the tar file using command below


$ wget https://download.java.net/java/GA/jdk19.0.2/fdb695a9d9064ad6b064dc6df578380c/7/GPL/openjdk-19.0.2_macos-x64_bin.tar.gz


  1. Untar the file and move the folder to Mac OS Java location

$ tar -xvf openjdk-19.0.2_macos-x64_bin.tar.gz

$ sudo mv jdk-19.0.2.jdk /Library/Java/JavaVirtualMachines/


  1. Set environment variable to be able to use java from any location by adding the following to .bash_profile

$ vi $HOME/.bash_profile


JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-19.0.2.jdk/Contents/Home"

PATH="${JAVA_HOME}/bin:${PATH}"

export PATH


  1. Restart the shell or source the bash_profile

Comments

Popular posts from this blog

ORA-44412: XE edition memory parameter invalid or not specified

How to mount a WD Book Live as NFS in OEL6U3

BPEL Engine Exceptions ORABPEL 02000 - 02179