The mechanism to load the jogl.dll or the libjogl.so files currently implemented in JOGL is suboptimal. Using System.loadLibrary works, but only the library is in found within a given path.
I’ve written a library loader, that is abled to
a) load jogl.dll / libjogl.so from a JAR/folder in the classpath
b) look for libjogl.so / jogl.dll in a place depending on the architechture (one is abled to put all native libraries for all architechtures supported into one JAR file or folder)
Well, for that loader to work, i have to disable JOGL own mechnism to load jogl.dll / libjogl.so.
Since all classes that need the native library call the load() method of the class NativeLibLoader, the following drop-in replacement will work and provide backward compatibility:
package net.java.games.jogl.impl;
public class NativeLibLoader
{
private static volatile boolean DO_LOADING = true;
private static boolean DONE_LOADING = false;
public static void disableLoading()
{
DO_LOADING = false;
}
public static void enableLoading()
{
DO_LOADING = true;
}
public static synchronized void load()
{
if (DO_LOADING && !DONE_LOADING)
{
System.loadLibrary("jogl");
DONE_LOADING = true;
}
}
}
of course the line System.loadLibrary(“jogl”); has to be replaced by the more complex code that is currently in the static constructor of the class NativeLibLoader.