Dominik Dominik - 6 months ago 32
Java Question

How to include win32com.dll into a jar file?

I am developing a Java application which has to be executed and installed without admin rights. My application needs the

win32com.dll
(Java Communication API) and the file
javax.comm.properties
.

Normally, I just copy the dll to
C:\Java\jre1.6\bin
and the config file to
C:\Java\jre1.6\lib
.

But I can't do all that in the target environment. Is there a way to solve this problem?

E.g. passing the location of these files to the java command in the command line, or including the files into the jar and load them from the source code?

Answer

Yes, you can just use something like this

java -Djava.library.path=/path/to/the/win32com.dll -cp /my/classpath/;/my/classpath2/ my.main.TheClass