How to Install Java on Mac with M3, M2, M1 Apple Silicon Chip

Jun 3, 2024 - 1 Comment

How to install Java on an Apple Silicon Mac

Some Mac users may need to install Java on their Apple Silicon equipped Mac – whether it’s an M1, M2, M3, or other M-series ARM chip – allowing them to run Java-based applications and software on their computers. Whether it’s to run specific enterprise software, use particular educational tools and compsci courses, run Java web apps, or to access and use Java development tools and the JDK (Java Development Kit), there are numerous reasons why installing Java in MacOS can be necessary, though it’s typically only advanced users and developers who require Java.

Modern Macs and modern versions of MacOS do not include Java by default and haven’t for quite some time, so if you need Java on an Apple Silicon Mac, you will have to install it manually. We’re going to demonstrate how you can install Java on an M-series Mac with an M3, M2, M1, or whatever Apple Silicon Mac you’re using.

How to Install Java on Mac with Apple Silicon Chip (M3, M2, M1, etc)

This particular walkthrough will demonstrate installing Java on an M-series MacBook Pro running the latest MacOS Sonoma release:

  1. Go to the Java downloads page at oracle.com here and select the “MacOS” tab
  2. For an Apple Silicon (M1, M2, M3, etc) Mac, choose the “ARM64 DMG Installer” download (Intel Mac users can use the X64 download, but we’re focusing on Apple Silicon here)
  3. After the DMG file has downloaded, mount the DMG file as usual and then click on the pkg installer to begin installation of Java on the Mac
  4. Complete installation as usual by going through the installer
  5. Go through installer for Java on Apple Silicon Mac

  6. Java is now installed on the Mac, which you can confirm by going to the Terminal application and typing the following command:
  7. java --version

  8. Optionally, you may need to set your JAVA_HOME path in Zsh for things to work as expected. From the Terminal in MacOS, run the following command:
  9. nano .zshenv

  10. Add the following line to .zshenv:
  11. export JAVA_HOME=$(/usr/libexec/java_home)
    Set JAVA_HOME path

  12. Hit Control+O to save and Control+X to exit from nano, and then type the following:
  13. source .zshenv

  14. Hit return to execute, and confirm that your JAVA_HOME path is set by typing and executing the following command:
  15. echo $JAVA_HOME

You’ll see the path to the Java JDK printed, verifying that both Java is installed and your JAVA_HOME environmental variable is set correctly. (Quick sidenote; some command line users prefer to put the export command into .zshrc instead of .zshenv, which should work exactly the same)

This is perhaps the easiest way to install the latest version of Java on an M3, M2, M1, and M-series Apple Silicon Mac, though users can also install Java through Homebrew if they’d like.

With Java now successfully installed on the Mac, the Apple Silicon Mac is ready to run whatever Java applications are necessary, or to work on Java-based projects with the JDK or JVM compiler.

There are tons of Java-based apps in use in enterprise environments and educational environments, and Java is very commonly used in programming and development too. In fact, a wide range of computer science curriculums use Java for coursework due to it being an object-oriented programming language, and having cross-platform compatibility and convenience.

Whether you’re using Java on an M-series Mac for running Java apps or developing Java software, and whether for professional, educational, or personal use, you’re now ready to go.

For some background, Java used to ship with MacOS, but that hasn’t been the case since High Sierra, which was the first version of MacOS to ship without it preinstalled. Instead, now all Mac users who require Java on their computers need to install it manually. Some may consider this inconvenient, but the good news is that by installing Java yourself, you can choose which version to install, and be sure that you have a new release with the latest security patches and features available, rather than using an older version of Java on a Mac.

And no, you do not need to install Java to use Javascript. Javascript is built into every modern web browser and enabled by default, as Javascript is a major component of basically every modern website and web service. Javascript and Java are actually two completely different languages and things, so even though they have similar names, it’s important to make that distinction between the two.

Do you require Java on your Mac? Were you able to install Java successfully on your M4, M3, M2, or M1 Mac, whether it’s a MacBook Pro, MacBook Air, iMac, Mac Mini, or Mac Pro? Do you have another approach for installing Java on an Apple Silicon Mac that worked better for you? Share your experiences and thoughts in the comments.

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks

One Comment

» Comments RSS Feed

  1. mrfloris says:

    Developers and those who want to run a Minecraft server, can also manually browse to https://www.oracle.com/java/technologies/downloads/#jdk22-mac and get the ARM64 Compressed Archive or wget/curl the compressed tarball file, and unpack it, then browse to “/Library/Java/JavaVirtualMachines/” and plunk it there, it will prompt the system’s pass. After which it is installed and ready to be used, java –version will show so.

    Avoid headless!

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site