This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to load a DLL bundled in a JAR ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to load a DLL bundled in a JAR ?" Watch "How to load a DLL bundled in a JAR ?" New topic
Author

How to load a DLL bundled in a JAR ?

Johan Vandevenne
Greenhorn

Joined: Jun 03, 2001
Posts: 10
Hello,
I have to load a DLL which is bundled in a JAR. If I do not include them in a JAR, I can load the DLL with System.load(thePath). This works fine.
Now to load it from a JAR i do this:
// Get current classloader
ClassLoader cl = this.getClass().getClassLoader();

// Create path
String lsFile = new String((cl.getResource("STDCExcel.dll")).getPath());
// load DLL
System.load(lsFile);
The System.load gives me a unsatisfiedlinkError, the lsPath variable contains: file:/C:/JRE/1.3.1/lib/ext/office.jar!/STDCExcel.dll
The Office.jar is infact the correct JAR which contains the DLL.
What's wrong ?? thnx
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to load a DLL bundled in a JAR ?
 
Similar Threads
JSP loading a dll
Dll Loading
How to:using routines of a dll
a very primitive problem
UnsatisfiedLinkError when using custom ClassLoader