Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ for more details.
I've recently installed the JDK 8 on my rMBP and all of a sudden NetBeans stopped working for me. I've dug into this a little further and tried several things, none of which worked, in the end I ended up forcing NetBeans to use JDK 7 and everything was working again.

First NetBeans stopped launching from my Dock, so I opened up Terminal and tried to launch it manually, this presented me with the following error:
> open /Applications/NetBeans/NetBeans 7.1.2.app
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/NetBeans/NetBeans 7.1.2.app.


Not much information here, so I tried to launch the NetBeans binary instead:
> /Applications/NetBeans/NetBeans 7.1.2.app/Contents/Resources/NetBeans/bin/netbeans
Unrecognized VM option 'MaxPermSize=384m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


Now I was getting somewhere.



The /Applications/NetBeans/NetBeans 7.1.2.app/Contents/MacOS/netbeans script has the following setting:
netbeans_default_options="-J-XX:MaxPermSize=384m ${netbeans_default_options}"


I tried removing the MaxPermSize setting, but it still failed with:
Unrecognized VM option 'PermSize=32m'


I dug in deeper and removed the PermSize setting from /Applications/NetBeans/NetBeans 7.1.2.app/Contents/Resources/NetBeans/etc/netbeans.conf.

Now the slash screen was showing up, yet NetBeans would still crash. The ~/.netbeans/7.1.2/var/log/messages.log file had the following exception:
java.lang.IllegalStateException: java.lang.IllegalAccessException: Class org.openide.util.WeakListenerImpl$ProxyListener can not access a member of class org.openide.filesystems.$Proxy0 with modifiers "public"
at org.openide.util.WeakListenerImpl$ProxyListener.<init>(WeakListenerImpl.java:423)
at org.openide.util.WeakListenerImpl.create(WeakListenerImpl.java:164)
at org.openide.util.WeakListeners.create(WeakListeners.java:271)
at org.openide.filesystems.MultiFileObject.<init>(MultiFileObject.java:125)
at org.openide.filesystems.MultiFileObject.<init>(MultiFileObject.java:142)
at org.openide.filesystems.MultiFileSystem.getMultiRoot(MultiFileSystem.java:267)
at org.openide.filesystems.MultiFileSystem.findResource(MultiFileSystem.java:355)
at org.openide.filesystems.FileUtil.getConfigFile(FileUtil.java:2227)
at org.openide.filesystems.FileUtil.getConfigRoot(FileUtil.java:2257)
at org.netbeans.core.startup.Main.getModuleSystem(Main.java:162)
at org.netbeans.core.startup.Main.start(Main.java:308)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
at java.lang.Thread.run(Thread.java:745)


This is do to with the Java security manager, everything I tried to disable it made NetBeans not start at all, the only workaround was to force JDK 7 to be used instead. I updated the /Applications/NetBeans/NetBeans 7.1.2.app/Contents/Resources/NetBeans/etc/netbeans.conf file to have the following entry in my case:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home"


Now NetBeans starts as expected.

-i

Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
comments powered by Disqus
Other posts you may like...