How to Install Java on macOS? Export JAVA_HOME Env variable in .bash_profile | Latest JDK (2021)

Опубликовано: 15 Март 2026
на канале: SrcCodes
14,550
243

Wondering, How to Install Java on macOS and set JAVA_HOME for LatestJDK 15? Write, compile & run your first Java code to verify the Java installation. Step by step java beginners guides to download Oracle JDK and installation of Java on macOS.

Detailed steps to write, compile and run a Java Hello World Example: https://www.srccodes.com/java-hello-w...

0:13 How to check jdk version
java -version

0:43 Download Java JDK
Download Oracle JDK (macOS Installer) from https://www.oracle.com/java/technolog...

2:05 Install Java
Run the downloaded JDK binary installer and follow the installation wizard.

3:33 Set JAVA_HOME
Set macOS system environment variables for JAVA_HOME

3:41 What is .bash_profile?

6:52 How to find Java path
java -XshowSettings:properties -version

8:54 Verify java home
Verify Java is Installation & JDK configuration
java -version
echo $JAVA_HOME

10:16 Java HelloWorld Example
Copy & paste the sample Java HelloWorld code in the HelloWorld.java file

public class HelloWorld {

/**
@param args
*/
public static void main(String[] args) {
System.out.println("Hello World!");
}

}

11:08 How to compile a java program
Compile the HelloWorld java file
javac HelloWorld.java

11:38 How to run a java program
java HelloWorld


#Java #Install #mac #JavaInstallation #JavaJDK15 #SrcCodes #Java15 #Javatutorial #macOS

~~~~~~~~~~~~~~~~~~~~~
Follow Me on:
Facebook:   / abhijit.gh0sh  
Twitter: https://twitter.com/intent/follow?sou...
Linkedin:   / abhijitghosh  
~~~~~~~~~~~~~~~~~~~~~
For more tutorials subscribe & follow
Youtube: https://youtube.com/srccodes?sub_conf...
Facebook:   / srccodes  
Twitter: https://twitter.com/intent/follow?sou...
Website: https://www.srccodes.com

Please Like and Subscribe to support this channel.