Hey, guys.
I’m trying to dynamically load the libs for jOGL in code so as not to require a -classpath/-Djava.library.path command line issue.
This is the function as I have it right now:
/** Load the appropriate libraries for the JOGL bindings.
* @param iOS An operating system constant (see above in GameFrame.java) /
public static void loadGL(int iOS)
{
try
{
URL urlJOGL = (new File(Tools.GetRelativePath(null) + Tools.GetFileSeparator() + “jogl.jar”)).toURL();
URL[] urls = { urlJOGL };
new URLClassLoader(urls);
}
catch (MalformedURLException exc) { / TODO: Log */ }
String strJOGL = Tools.GetRelativePath("org.slage.ui.jogl.");
switch (iOS)
{
case WIN32:
System.load(strJOGL + "jogl.dll");
System.load(strJOGL + "jogl_cg.dll");
break;
case LINUX:
System.load(strJOGL + "libjogl.so");
System.load(strJOGL + "libjogl_cg.so");
break;
case MACOSX:
System.load(strJOGL + "libjogl.jnlib");
System.load(strJOGL + "libjogl_cg.jnlib");
break;
case SOLARIS_SPARC:
System.load(strJOGL + "libjogl_solsparc.so");
break;
case SOLARIS_X86:
System.load(strJOGL + "libjogl_solx86.so");
break;
}
}
Note: I renamed the solaris .so files so they would all have unique filenames; not sure if this will be an issue or not.
When I run this code, I get a message box from java.exe that tells me “A required DLL, jawt.dll, is not found…” etc. I checked my JRE and JDK directories; sure enough, it’s there. I also ran another AWT/Swing app to verify that it’s working. So, something in my code has to be causing this issue.
Does anyone have any suggestions on how to fix the problem, or another method for solving the dynamic loading quandary? ???