Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get NetBeans 12.0 to launch on Mac (MAC OS 11.0 beta / Big Sur)

On Mac (Big Sur) when I click on the Netbeans 12 icon in the doc it bounces briefly then fails to launch Netbeans.

like image 726
Devology Ltd Avatar asked Sep 10 '20 08:09

Devology Ltd


3 Answers

The answer helped me launch Netbeans from the terminal. I added this change to make my dock icon launch Netbeans like before.

I changed the Netbeans config file to make it launch with the Java path:

  1. Like the previous post indicates find your JDK path with this command in the Terminal
/usr/libexec/java_home -v '1.7*'
  1. Now add this path to the Netbeans conf file. To do this:
  • right click on the Netbeans icon in the dock and select Open in Finder
  • in the smaller icon it shows right click again and select Show sources
  • find the netbeans.conf file in folder Resources/NetBeans/netbeans/etc/netbeans.conf
  • open this netbeans.conf file with a TextEditor or similar and find the line
#netbeans_jdkhome="/path/to/jdk"

Uncomment this line and change it for your path (the one you found in point 1) something like

netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home"

Save the netbeans.conf file and try and launch from the Dock icon

like image 119
Gemma Avatar answered Oct 04 '22 02:10

Gemma


If you right click on the icon in the dock --> Options --> Show in Finder the operating system will show you where 'Apache Netbeans 12.0' is located.

Highlight 'Apache Netbeans 12.0' then right-click and choose 'Show Package Contents', then you can find a shortcut that launches Netbeans (Contents/MacOS/netbeans).

If you double-click to launch netbeans you'll be presented with the following reason why it fails to load.

/Applications/NetBeans/Apache\ NetBeans\ 12.0.app/Contents/Resources/NetBeans/netbeans/bin/netbeans ; exit;
rob@Robs-MBP-2015 ~ % /Applications/NetBeans/Apache\ NetBeans\ 12.0.app/Contents/Resources/NetBeans/netbeans/bin/netbeans ; exit;
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.

Cannot find java. Please use the --jdkhome switch.

Credit goes to How can I change Mac OS's default Java VM returned from /usr/libexec/java_home for providing the following step to determine what the JDK path is...

/usr/libexec/java_home -v '1.7*'

Then you can type the following (adjust for your path and version required)

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home"

However that didn't seem to do the trick for me (I also tried JDK_HOME), so instead from a Terminal window type the command to launch Netbeans but include the --jdkhome to your Java home folder, e.g.

/Applications/NetBeans/Apache\ NetBeans\ 12.0.app/Contents/Resources/NetBeans/netbeans/bin/netbeans --jdkhome /Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home

Now I have Netbeans launching again. I'm not quite sure why the JAVA_HOME doesn't resolve this, but hopefully in the meantime anyone unable to launch Netbeans can at least use this workaround.

I've also found this How to run a shell script in OS X by double-clicking? useful to ensure I can double-click on the shell script to run it from a shortcut on my desktop.

like image 22
Devology Ltd Avatar answered Oct 04 '22 00:10

Devology Ltd


For some reason, some Netbeans versions for Mac OS do not detect the JDK contained in JRE. For proper installation and running the application,you must have Java for Mac OS installed previously. https://www.java.com/es/download/

like image 39
juanmgar Avatar answered Oct 04 '22 00:10

juanmgar