loading dll
495018Mar 15 2006 — edited Mar 21 2006Hi,
I'm writing a Java application under Oracle 9i which uses a .dll through a System.loadLibrary(...) statement.
After many tries and failures looking for the dll into the file system, I'm switching to another solution: I would like to use a dynamic resolution like this:
public static void testLoad() {
URL u;
try {
String s = "jserver:/resource/dynamic/" + System.mapLibraryName("libName");
u = new URL(s);
System.out.println("external form : " + u.toExternalForm());
System.out.println("path : " + u.getPath());
//System.load(u.getPath());
System.load(u.toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
I then loaded the .dll as a JAVA_RESOURCE with loadjava, and built the PL/SQL wrapper around the class, but then I had this error:
SQL> exec test_load;
external form : jserver:/resource/dynamic/libName.dll
path : /resource/dynamic/libName.dll
java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: jserver:/resource/dynamic/libName.dll
at java.lang.Runtime.load0(Runtime.java)
at java.lang.System.load(System.java)
at TestPath.testLoad(TestPath.java:74)
It seems like the system keeps searching the file into the file system...
So is the jserver:/resource/dynamic useful only to load properties? (is the only case in which I used this technique successfully...)
Is there any way to load the .dll dynamically and as a resource, without having to worry about those strange and funny things like LIBPATH etc.?? :-)
(I know maybe the problem could be easily solved with a proper machine configuration, but my admin was not so helpful to me in doing this, so I wanted to find another way!)
Thanks in advance!
Vincent