OpenJDK weirdness on OSX Leopard

Posted by Marco Dinacci on 0 comments

This post is to document a couple of issues encountered while deploying an OpenJDK 7 based app on OSX Leopard.
The first is a JVM crash caused by a supposedly closed bug in hotspot.
The crash happens when the is compiled at run-time, normally a fraction of a second after the application launches.
The only workaround I've found is to launch your application with the following line:


which tells hotspot not to compile that method.

The second issue is a NullPointerException in Here's a partial stacktrace:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
  at sun.misc.URLClassPath$JarLoader.checkResource(
  at sun.misc.URLClassPath$JarLoader.getResource(
  at sun.misc.URLClassPath.getResource(
  at Method)
  at java.lang.ClassLoader.loadClass(
  at sun.misc.Launcher$AppClassLoader.loadClass(
  at java.lang.ClassLoader.loadClass(

The line causing the NPE is:

char[] retCC = new char[path.length() * 2 + 16];

which means that somehow the path is null. As bizarre as it may seems this can be fixed using these two JVM options:

-XX:-UseLoopPredicate -XX:-LoopLimitCheck

which you may remember it was used to fix a nasty problem in hotspot in the first public release of Java 7.