Resolving ‘No JDK found’ when installing NetBeans in MacOS Big Sur

Credit: Scott Webb

MacOS Big Sur makes changes related to JAVA_HOME and will result in an error message stating No JDK found despite there being a JDK. Here's how I resolved it.

From the command line, I ran /usr/libexec/java_home -V. This will output the Java VMs that are installed:

Matching Java Virtual Machines (4):    
14.0.1 (x86_64) "UNDEFINED" - "OpenJDK 14.0.1" /usr/local/Cellar/openjdk/14.0.1/libexec/openjdk.jdk/Contents/Home
1.8.271.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_271 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
1.8.0_251 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

If you don’t see JDK 1.8, then you should go to Oracle.com and install it. Assuming you have 1.8, you should set that as your JAVA_HOME with the following command, export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home".

Note that your location may be slightly different from mine; you should use the location for 1.8 that was present in your list of VMs when you ran /usr/libexec/java_home -V, above.

I would also recommend you add this to your shell profile so that the current JAVA_HOME is set the next time you reopen your shell. I'm using ZSH as my shell, so the command I used was echo 'export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home"' >> ~/.zshrc.

Now you’re almost home… just make sure you have Homebrew and then run brew cask install netbeans.

This should enable you to install it without issue and will place it in your Applications folder.

Hope that helps. :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store