How to Install Java on MacBook Air M1/M2/M3 Latest Chip | Install Java JDK on macOS

Опубликовано: 13 Март 2025
на канале: Learn Automation Testing from scratch
6,123
110

How to Install Java on MacBook Air M3 Latest Chip | Install Java JDK on macOS: This Java tutorial for beginners will teach you about all the concepts required to install Java/JDK/OpenJDK on your Apple MacBook & setup JAVA_HOME environment variable on MacBook M1/M2/M3 latest chips. This complete Java course for Software developers and testers will help you master all the concepts you need to learn in Java in a well structured way.

In this video, we’ll walk you through the entire process, from downloading the Java Development Kit (JDK) to setting up the environment variables. Whether you’re a beginner or need a refresher, this video has got you covered.

🔍 What You’ll Learn:

1. How to download and install the latest JDK from the official Oracle website. https://www.oracle.com/java/technolog...
2. Setting up Java environment variable JAVA_HOME on MAC.
3. Verifying the installation to ensure everything is working correctly.

Additional Tips:

Inbuilt MAC utility to check the path of Java installation -
/usr/libexec/java_home -V

There are 2 types of MAC architectures/MAC Chips -
1. Intel based MACs(x86_64) or the older chip.
2. Apple Silicon MACs(arm64) or the latest chip.

To find out your MAC architecture, open Terminal and type this command -
uname -m

If the output is arm64, you have to download ARM64 version. If you get the output as x86_64, then you should go with x64 DMG installer.

What is JAVA_HOME environment variable - It's a variable that tells your system where Java is installed.

To create the .zshrc file, navigate to the home directory and run the below command
touch .zshrc

To edit the .zshrc file, instead of opening in complicated terminals like nano or vim, simply open in text editor with this command
open .zshrc

This is the syntax to add environment variables in .zshrc file
export VARIABLE_NAME=value

Make sure there is no space before and after the =.

Copy and paste the below lines in your machine. Just make sure that your JAVA_HOME path is correct

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

To verify that the JAVA_HOME variable is set correctly, you can run:
echo $JAVA_HOME

In case of any doubts, please feel free to ask me in the comments section.

►This playlist is a part of my Complete Java Course from scratch:    • Java Complete Course from scratch ste...  

#Java #JavaInstallation #JavaOnMAC #Programming #JDK #JavaDevelopment #CodingTutorial #TechTutorial #MACTutorial #InstallJava #JavaSetup