Dyapa Srikanth
Dyapa Srikanth

Reputation: 1241

Setting library path for dll which is in jar file

In my netbeans desktop application i kept .dll files of Rxtx inside the project. Can i set library path for those .dll files.

This is project hierarchy

projectName

Thanks in advance.

Upvotes: 0

Views: 1912

Answers (1)

Santosh
Santosh

Reputation: 17923

When a java code loads a native library (generally done via System.load()), this call is a native call to OS. The actual loading of DDL is done by OS (Please correct me if this is not so). In that case the OS would need a definite path to the dll to be loaded. If the DLLs are inside some jar file, the OS does not recognize jar files structure (it can only be interpreted by java runtime) so those files wont be found when packaged inside jar.

Just an example, for a standard JDK distribution, all the class files are packaged in rt.jar file, whereas all the native code DLLs (sockets, awt etc ) are at a separate location (jre/bin). So my suggestion would be, create two set of files one jar and other DLLs. Create a ZIP archive. Now if anybody who needs to use this, have to unzip, keep jar in classpath and DLLs in PATH.

Upvotes: 4

Related Questions