问题
I have installed Big Sur on my MacBook Air. Java is installed but Netbeans install says no Java JDK found. Did anybody has the solution for this issue?
回答1:
Here's how I resolved it. From the command line, I ran:
/usr/libexec/java_home -V
This will output the Java VMs you have 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 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.
That should enable you to install it without issue and will place it in your Applications folder.
回答2:
Same here , it is because Big Sur update have erased $JAVA_HOME. echo $JAVA_HOME is empty and you cannot redirect to .bash_profile . Maybe Big Sur updates will fix this. I am waiting/searching for an answer myself. Not about to downgrade to Catalina just yet
回答3:
I resolved my problem like this and it worked out wonderfully:
Issue:
When I executed Netbeans through command line in verbose mode, I saw the following error
./netbeans -v
The operation couldn’t be completed. Unable to locate a Java Runtime that supports (null).
Please visit http://www.java.com for information on installing Java.
Solution:
Edit netbeans.conf file
vi /Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
Look for netbeans_jdkhome variable, uncomment it and substitute it appropriately. In my case the setting was:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home"
Once you have done that, you can start Netbeans normally using the Netbeans shortcut or by using the command line.
回答4:
I solved it by installing JDK15 and Apache Netbeans 12.2 (Only 12.2).
It works well.
来源:https://stackoverflow.com/questions/63424844/netbeans-does-not-install-on-macos-big-sur