Hello Guest

Always getting NullPointerException on startup when running on Mac OSX

  • 2 Replies
  • 4209 Views
Great job on this library BTW. It is working for me flawlessly on both Linux and Windows. However, I am always getting this NPE when starting to use lwjgl on Mac OSX:


java.lang.NullPointerException
   at org.lwjgl.system.APIUtil.apiGetManifestValue(APIUtil.java:92)
   at org.lwjgl.system.Library.checkHash(Library.java:260)
   at org.lwjgl.system.Library.<clinit>(Library.java:44)

When I look at the code there I can see it does this:

URL url = Thread.currentThread().getContextClassLoader().getResource("org/lwjgl/system/APIUtil.class");

The getContextClassLoader() can return null according to the Javadocs for this method:

"The context ClassLoader for this Thread, or null indicating the system class loader (or, failing that, the bootstrap class loader)"

So I guess a check for null in thi case would fix the crash.

I found a workaround. If I call Library.initialize() on my main thread it fixes this problem!

*

Offline spasi

  • *****
  • 2256
    • WebHotelier
Thanks, it should be fixed in the next nightly build.