🌐
CodeJava
codejava.net › java-se › install-oracle-jdk-18-on-macos
Download and Install Oracle JDK 18 on macOS
Guide to download and install Oracle JDK 18 on macOS, step by step. How to setup Oracle JDK 18 on macOS.
🌐
CodeJava
codejava.net › java-se › install-openjdk-18-on-macos
Download and Install OpenJDK 18 on macOS
How to download binary archive file of OpenJDK 18 for macOS and install OpenJDK 18 on macOS, step by step.
🌐
Thejavaguy
thejavaguy.org › posts › 001-how-to-install-jdk-18-on-macos
How to install Java 18 (OpenJDK 18) on MacOS - TheJavaGuy Blog 🚀
March 10, 2022 - In this article I will show you how to install JDK 18 on MacOS and to setup IntelliJ IDEA so you can write Java applications against it. First you have to visit https://jdk.java.net/18/. Near the top you’ll see build number and download links ...
🌐
Bell Software
bell-sw.com › pages › downloads
Java Download | Java 8, Java 11, Java 17, Java 21, Java 25 - OpenJDK Builds for Linux, Windows & macOS
Download Liberica JDK, supported OpenJDK builds. Open source Java 8, 11 and more for Linux, Windows, macOS.
🌐
Oracle
docs.oracle.com › en › java › javase › 18 › install › installation-jdk-macos.html
4 Installation of the JDK on macOS - Java
July 6, 2022 - Previous Next JavaScript must be enabled to correctly display this content ... The JDK supports both Intel-based (x64) and Apple Silicon (AArch64) Mac computers. ... For supported processors and browsers, see Oracle JDK Certified Systems Configurations. Instructions for installing JDK contains a version notation that represents the Feature, Interim, and Update version information. For example, if you are installing JDK 18 Interim 0, Update 0, and Patch 0, then the following string represents the name of the bundle:
🌐
Azul Systems
azul.com › home › azul downloads
Java 8, 11, 17, 21, 25 Download for Linux, Windows and macOS
January 30, 2023 - Click here to download the Azul Zulu Builds of OpenJDK for Java 8, 11, 17, 21, 25 for Linux, Windows and macOS. Also download Azul Platform Prime.
Find elsewhere
🌐
Oracle
jdk.java.net › 18
JDK 18 Releases - Java.net
JDK 18 has been superseded. Please visit jdk.java.net for the current version.
🌐
Oracle
oracle.com › java › technologies › downloads
Download the Latest Java LTS Free
Download the Java including the latest version 17 LTS on the Java SE Platform. These downloads can be used for any purpose, at no cost, under the Java SE binary code license.
Top answer
1 of 13
400

In 2024, even if you can use just brew..

brew install openjdk@17 

Java will be installed here:

/opt/homebrew/opt/openjdk@17/bin/java

for Apple Intel path is /usr/local/... rather than /opt/homebrew/...

For the system Java wrappers to find this JDK, symlink it with:

sudo ln -sfn /opt/homebrew/opt/openjdk\@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

resp. for Intel

sudo ln -sfn /usr/local/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Now, running /usr/libexec/java_home -V should show the path to JAVA 17, something like:

17.0.9 (x86_64) "Homebrew" - "OpenJDK 17.0.9" /opt/homebrew/Cellar/openjdk@17/17.0.9/libexec/openjdk.jdk/Contents/Home

(This is what you are missing btw, if javac or javac --version does not give you a command-not-found but an The operation couldn’t be completed. Unable to locate a Java Runtime.)

In case you see the wrong version, check if the path to JAVA_HOME is set correctly. If not, you could set it by:

export JAVA_HOME=\$(/usr/libexec/java_home)

...give a try to sdkman, it's far better than brew

curl -s "https://get.sdkman.io" | bash

then open a new shell and try list to see what you could install ;-)

sdk list java 

At time of writing you could use:

sdk install java 17.0.4.1-tem

Java will be installed here:

/Users/YOUR_USERNAME_HERE/.sdkman/candidates/java/17.0.4.1-tem
2 of 13
56

Java doesn't mind if you install multiple versions. This is often required; java is not backwards compatible (it tries to change little, but e.g. the java8 to java9 transition broke a ton of stuff, much of it needless and much of it not reasonably expectable or fixable by libraries and apps, so a bunch of java apps and libraries only run on java8 - just an example).

So, yes, you have installed JDK17. Also, yes, if you just run java without specifying which one you want, you so happen to get java13 here.

To see all installed javas, you can run:

/usr/libexec/java_home -V

to 'override', you can use something like (depends on which shell you're using on your mac):

export JAVA_HOME=`/usr/libexec/java_home -v 17`

(the backticks mean: Run this then take the output of it and treat that as the 'value' of the expression. here, assign it to the JAVA_HOME env var. -v 17 requests a path to java 17. The -V option lists all and is meant for your eyeballs, not for scripts. The -v option is mostly for scripting, and that's how we're using it here).

JAVA_HOME decides which java is used by some things, but the java you get when you just type java is /usr/bin/java, and that executable is actually just a wrapper that picks a java to run from amongst all installed versions. It uses JAVA_HOME to decide which java to actually run. There are wrappers for all the common commands (javac, too). You can always run e.g. which javac to see what that actually runs; you probably see /usr/bin/javac. Everything in /usr/bin is one of these wrapper thingies that looks at JAVA_HOME and then runs the binary it finds there.

🌐
Oracle
java.com › en › download › apple.jsp
Download Java
» 为什么推荐 Java 8 » Java 是什么 » 删除旧版本 » Windows 常见问题 » 安全性 » Support » 其他帮助 · 此下载用于帮助那些需要使用 Java 在台式机和笔记本电脑上运行应用程序的最终用户。Java 8 与操作系统集成在一起以运行单...
🌐
OpenLogic
openlogic.com › openjdk-downloads
OpenJDK Downloads | OpenLogic
OpenLogic now provides free, quarterly builds of OpenJDK 8, OpenJDK 11, OpenJDK 17, and OpenJDK 21 for Linux, Windows, and MacOS. ... Note: Open source OpenJDK is provided free of charge and "as is", without warranty of any kind, express or implied. In no event shall Perforce Software, Inc. or its affiliates be liable for any claim, damages, or other liability arising from out of or in connection with open source OpenJDK software downloaded from this site.
🌐
Oracle
oracle.com › java › technologies › javase › jdk17-archive-downloads.html
Java Archive Downloads - Java SE 17.0.12 and earlier
Go to the Oracle Java Archive page. This page includes archive downloads for JDK 17 updates 17.0.12 and earlier.
🌐
Andrew Hoog
andrewhoog.com › posts › 3-ways-to-install-java-on-macos-2023
3 ways to install Java on macOS [2023] | Andrew Hoog
January 12, 2023 - So generally folks will go to java.com and be presented with the following website which by default is focused on installing a Java runtime for users, not the Java Development Kit developers need: So don’t click the green Download Java button! :-) Instead, click on the OpenJDK Early Access Builds which will then let you select which JDK you want to install. For the demo, we’ll just go with the latest version (OpenJDK 19 as of Nov 2022) and you’ll be taken to a page with links to platform specific downloads. Since Apple moved using their own ARM chips (“Apple Silicon”) starting with the M1 series, you’ll have to choose between “macOS / AArch64” (Apple M1 and above) and “macOS / x64” (older Intel chips).
🌐
TechSpot
techspot.com › downloads › 2017-java-jdk-18.html
Java SE JDK 18.0.2.1 Download Free | TechSpot
September 13, 2022 - Download Java 18 - The Java Platform 18 Development Kit (JDK 18) is a feature release of the Java SE platform. It contains new features and enhancements in many functional areas. This is the latest Java version.
Rating: 4.2 ​ - ​ 12 votes