Always getting NullPointerException on startup when running on Mac OSX

Started by Nickallen2, July 03, 2016, 00:11:57

Previous topic - Next topic


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:

   at org.lwjgl.system.APIUtil.apiGetManifestValue(
   at org.lwjgl.system.Library.checkHash(
   at org.lwjgl.system.Library.<clinit>(

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!