Since OS X 10.7 Java is not (pre-)installed anymore, let’s fix that. As I’m writing this, Java 11.0.9 is the latest LTS (Long Term Support) version and AdoptOpenJDK is one of the best places to find Prebuilt OpenJDK Binaries. Easy to follow details about how to install OpenJDK are available here.
However, the easiest way is to select OpenJDK 11 (LTS), the HotSpot JVM, and macOS x64 is to get the latest release here:
Select macOS and x64 and download the JDK (about 190 MB), which will put the OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.pkg file into your ~/Downloads folder
Clicking on the pkg file will install into this location: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk
Almost done. After opening a terminal, the successful installation of the JDK can be confirmed like so:
… hopefully showing something like this:
openjdk 11.0.9 2020-10-20 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
JAVA_HOME is an important environment variable and it’s important to get it right. Here is a trick that allows me to keep the environment variable current, even after a Java Update was installed. In ~/.zshrc, I set the variable like so:
In previous macOS versions, this was done in ~/.bash_profile. Anyway, open a new terminal and verify:
echo $JAVA_HOME /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
The source code of the Java Platform, Standard Edition 11 Reference Implementations binaries is available under the GPLv2 in a single zip file.
The API Specification of the Java Platform, Standard Edition and Java Development Kit
can be found here: https://docs.oracle.com/en/java/javase/11/docs/api/
14 Replies to “Installing Java on macOS 11 Big Sur”
thank you very much . I could not install java correctly until I read your article .
Hi thanks for the useful info.
In case there are multiple Java versions the following command used to return in the previous macOS release the path of a specific version:
/usr/libexec/java_home -v “1.8*”
The above command in macOS 11.0.1 returns only the latest Java version.
Is this a bug or I need to modify the above command?
thank you for the article, but while setting the JAVA_HOME, I had to hardcode the actual path of the JDK /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home. The provided one did not work for me
Thank you. Worked fine 🙂
Wolf, please make a comment to this one:
Excellent tutorial, but as it seems there is a major error in ALL Java JDK and JRE versions around when it comes to Big Sur, as follows:
Any application now need permission to access system resources, but Java JDK/JRE does not pose such request, nor is this available as an API for a Java application (?).
In consequence, and as an example: If a java app requests DEFAULT audio input device (often the built in mic, but sometimes virtual sound cards like e.g. Blackhole), then everything is ok. But, if the app request an input device NOT currently set as default input, then this is rejected by Big Sur, and there is no audio stream sent to the java App.
Comparing Java behaviour to other non-java apps like e.g. Reaper DAW, one observes that Reaper community has grasped this rule so that Reaper is requesting permission everywhere. It means the Reaper user does not need to think about it after accepting these requests in Apple System Preferences security. Again, a typical example is permission to use the microphone.
Comparing Java and Reaper, Java does not ask any such permissions anywhere, which means all Java Apps are completely stuck until this is fixed. Well, not completely, since a mic can be used by any app also Java as long as it is system default.
I hope it is me that has not grasped how to instruct Java to pose such permission to Big Sur, but I fear not, and then how do we fix this?
my email: [email protected]
10000 Dank, sogar eine “Normalnutzerin” wie ich konnte damit endlich das Installationsproblem des JKD lösen. Wunderbar 🙂
Thank you for your blog Wolf. Apart from downloading the binary and install, you can also use the brew way to install adopt-openjdk in terminal and life is becoming easier.
brew install –cask adoptopenjdk
hello i didn’t found jdk 8 can you help me pls
I am bereft. I followed the instructions (so I believe). I have engaged with the Terminal, or perhaps it was the Terminator. I typed in the suggested messages and hoped! As yet, I cannot see Java between the Is and the Ks in my list of Applications. Where have I gone wrong? I feel the need to play Scrabble against a robot and this I cannot do without Java. What am I to do next? Please help!
I posted my previous comment on April 20th. Six weeks later and still no response. Just need to say that not all of us are tekkies; not all of us get what it is we have to do when we are presented with dry, technical language, such as is used on this site. I’m no further forward with resolving this problem than I was on April 20th and feeling very frustrated.
Java will not appear as a program in /Applications on Mac. The installation provides the supporting files needed to open/run Java .jar files which you could place in /Applications but their names won’t be “Java”.
Hello, even after following this article and install openJDK successfully, I still get an errror when runninf the sudo apt install command.
The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt.
Please visit http://www.java.com for information on installing Java.
Any idea on this>
Did the same thing as mentioned here but echo $JAVA_HOME gave an empty string despite making an entry in this file ~/.zshrc