Sorry for the late response, but I haven't had time to play with
things in a couple days.
First discovery is that I probably cannot use the library path
variable, because some of the DLLs have to be loaded in a specific
order. Specifically, there is a "clientswig.dll" that has to be loaded
last. Going back to the old style of loading them manually inside the
Clojure code, I still have a problem, though.
The problem now seems to be with the JAR file that I need to be using.
I get a NoClassDefFoundError on a class within the JAR: "Could not
initialize class ...ClientModuleJNI".
I have included the JAR in the build path as I traditionally would in
Eclipse (Properties -> Java Build Path -> Libraries -> Add JARs). I've
also tried launching from the command line and get the same error.
I've mangled the code below to hide company-specific information, but
this is what I'm doing right now.
--- In Clojure ---
(ns app)
(def path "C:\\SVN\\lib3rdParty\\")
(try (System/load (str path "client.dll")) (catch UnsatisfiedLinkError
e (println "Failed library load.")))
(try (System/load (str path "utils.dll")) (catch UnsatisfiedLinkError
e (println "Failed library load.")))
(try (System/load (str path "clientswig.dll")) (catch
UnsatisfiedLinkError e (println "Failed library load.")))
(import '(
com.app Client ClientSession))
(def my-client (Client.))
--- In Java ---
public final class AlertClient extends Client {
// Load the JNI
static {
try {
path = "C:\\SVN\\lib3rdParty\\";
String[] libraries = { "client.dll", "utils.dll",
"csclientswig.dll" };
for (int i = 0; i < libraries.length; ++i) {
String libPath = path + libraries[i];
System.load(libPath);
}
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n"
+ e);
System.exit(1);
}
}
public AlertClient() throws Exception {
super();
}
}