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

4

7

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

Favors answered 10/9, 2020 at 8:19 Comment(0)
O
18

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

Ollayos answered 13/11, 2020 at 15:20 Comment(3)
Thank you I spent a long time trying to figure this out.Sufism
Hey thanks @Ollayos for providing the additional details from my original answer - launching directly from the dock is much nicer, thank you. I've marked your answer as accepted as it's what I would have originally wanted 👏Favors
It would be much better to change the line in netbeans.conf to: netbeans_jdkhome="`/usr/libexec/java_home`". That keeps the conf file working as is when Java is updated on the machine.Hosanna
F
5

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.

Favors answered 10/9, 2020 at 8:19 Comment(1)
Please see the comment from @Ollayos - it provides extra details that gets the above working in the Dock 🤓Favors
D
1

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/

Daredeviltry answered 17/11, 2020 at 22:53 Comment(0)
P
0

I had the same issue after upgrading to macOS Big Sur from Mojave.

Before running commands in terminal, you could just try to reinstall Java for Mac OS X :

https://www.java.com/en/download/

It solves my issue. I am now able to launch NetBeans 12.1

Paganini answered 6/12, 2020 at 13:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.