java/javac on Big Sur

This thread has been locked. Questions are automatically locked after two months of inactivity, or sooner if deemed necessary by a moderator.

I need to run a jar file on Big Sur that runs fine on Catalina. Not only can't I run it, but when I back up and just try to compile and run a simple HelloWorld I can't do that on Big Sur either.

I have installed java but when I enter javac on Big Sur I get a file not found. I've also tried entering the entire path to the file and that doesn't work either.

On Catalina, the first time I tried this in a new file I got a pop-up that asks me for permission and then it works fine so my assumption is that this is a permissions issue.

Any thoughts?


Post marked as unsolved Up vote post of dimsumthinking

8 Replies

What directory are you in? Java works fine here, but not in a restricted directory like Downloads. If I move to /tmp, then everything works as expected.
Desktop - (which works on Catalina) - I'll give /tmp a try thank you
@Etresoft thank you - this worked perfect. I moved it to Dev and it works fine

Note that Big Sur breaks the previous behaviour of the JAVA_HOME environment variable to pick the Java version used to run the command-line tools. If this matters to you, consider filing an bug report.
I would suggest to use any kind of IDE which would solve your path issues, then verify JAVA_HOME and java version.
Hi there, I do not have an answer for your question, I have a question myself. Now you may have upgraded to the official release of macos big sur, is everything working fine ? And if you have these* apps installed please let me know if they have any errors.
  • Intellij Ultimate, Mysql server and Workbench, Photoshop, Brackets, Maven, Tomcat Server, Android Studio, Virtualbox and Tor.

Thank you .
Type this command in terminal: "/usr/libexec/java_home"

You should get something like: "/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home"

Now edit </Applications/NetBeans/Apache NetBeans xx.x/Contents/Resources/NetBeans/netbeans/etc/netbeans.conf> and search for netbeansjdkhome. Change it's path to match the above result.

It should now look something like this:


Now relaunch netbeans and try again. Hope this helps! ;-)
If you were getting the error The operation couldn’t be completed. Unable to locate a Java Runtime. when trying to run /usr/libexec/java_home, then check this article below to solve the issue. Apple doesn't let me post the link, so you will have to remove the space after '.net' and paste the whole link into the browser. /how-to-install-java-openjdk-15-on-macos-big-sur