I tested my own suggestion and unforunately - as stated - it doesn’t work. After that I tried the method from the javalobby forum, that lhkbob posted and this does indeed work It might be vendor-specific (sun vm only!?) and not future proof, but it should suffice for now.
Here is my working Launcher class (the Launcher might not be needed, but this way it is nicely separated and maybe I extend this to a generic wrapper):
import java.lang.reflect.Field;
/**
*
* @author cylab
*/
public class Launcher
{
public static void main(String[] args)
{
try
{
// Get the system paths field, make it accessible and to null
// so that whenever "System.loadLibrary" is called,
// it will be reconstructed with the changed value.
Field sys_paths = ClassLoader.class.getDeclaredField("sys_paths");
sys_paths.setAccessible(true);
sys_paths.set(ClassLoader.class, null);
// Now change the System property
System.setProperty("java.library.path",
"/home/cylab/.netbeans/6.5/jogl-runtime/jogl.jar-natives-linux-i586:/home/cylab/.netbeans/6.5/gluegen-runtime/gluegen-rt.jar-natives-linux-i586");
// Get the reference to the actual app class after setting java.library.path and start your app
Class.forName("org.yourorghere.SimpleJOGL")
.getMethod("main", new Class[]{String[].class}).invoke(null, new Object[]{args});
}
catch (Exception e)
{
e.printStackTrace();
System.exit(1);
}
}
}
You will still need some code to get the right platform library path.