How to install Java/JDK 21.0 on Mac M1, M2, MacBook Pro on macOS Ventura || Set Java_Home in Mac OS Ventura

In this tutorial session we will learn easy way to install JDK on MacOS Ventura and we will see how to setup java_home environment variable here in Mac OS Ventura.

Step 1: First we will download and install compatible JDK version for Mac OS Ventura.
(Mac M1 and M2 are ARM-based CPU architecture)
Link: https://www.oracle.com/java/technologies/downloads/#jdk21-mac

Step 2: Verify JDK installation via terminal.
Open terminal and type —> Java -version

Step 3: Now we create .zshrc file on Mac, if this file does not exist. Then we will add Java_Home in this file.

    Run command ls -al and check file exist on your system?
    If file not exist—> use command to create:  touch ~/.zshrc

    Given permission with command : chmod +x ~/.zshrc

    If file exist —> To open .zshrc in text editor run this command: open -a TextEdit ~/.zshrc    

       Add these entries in file and save :  
         export JAVA_HOME = “path upto JDK folder” (let’s find out installed JDK path)
         export PATH = $JAVA_HOME/bin:$PATH    

Step 4: Then echo $JAVA_HOME and then echo $PATH
As a result you will see added paths. This means our setup is Successful.

Step 5: Now you can go ahead and create and run your java programs.

Please watch the below video tutorial for better understanding of steps or if you are facing any issue in setting up java_home on your macOS machine.

If you find this tutorial useful, please hit like button to appreciate and Subscribe channel to appreciate and learn more.

India Visa

Indian e-Tourist Visa

Leave a Comment