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

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

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.