You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Abid Hussain <ab...@abid76.de> on 2006/12/15 15:00:34 UTC

using a dll in a webapp

Hi everybody,

I want to establish a connection to a serial port from my webapp by 
using the javax.comm package which uses the win32com.dll (on windows 
systems).

In most cases, it seems to be the common way to place the dll in the 
<jre>/bin directory. But I want to have all needed libraries in my 
webapp directory.

Therefore, I resolve the path of the dll in my webapp:
String win32com = new 
File(this.getClass().getClassLoader().getResource("win32com.dll").toURI()).getPath();

Now, I add the path to the java.library.path property:
System.setProperty("java.library.path", 
System.getProperty("java.library.path") + File.pathSeparator + win32com);

When I now output the java.library.path on the console (using 
System.getProperty("java.library.path")) the dll is in the path.

Now, I try to load the dll:
System.loadLibrary("win32com.dll");

And this fails. The Error message is:
java.lang.UnsatisfiedLinkError: no win32com.dll in java.library.path

I wonder how it's possible that the dll seems not to be in the 
java.library.path although I just added it - has anybody an idea?

Thanks a lot for helping.

Best regards,

Abid


-- 

Abid Hussain
Mail: abid.hussain@abid76.de
Web: http://www.abid76.de

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: using a dll in a webapp

Posted by Abid Hussain <ab...@abid76.de>.
Hi again,

sorry, I should have said that before. Adding the path without the 
filename (using String win32com = new 
File(this.getClass().getClassLoader().getResource("win32com.dll").toURI()).getParent();)
also doesn't work.

Loading the dll using
CommDriver commDriver = (CommDriver) 
Class.forName("com.sun.comm.Win32Driver").newInstance();
commDriver.initialize();
instead of
System.loadLibrary("win32com.dll");
fails, too.

Any ideas?

Best regards,

Abid


Christopher Schultz schrieb:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Abid,
> 
> Abid Hussain wrote:
>> I want to establish a connection to a serial port from my webapp by
>> using the javax.comm package which uses the win32com.dll (on windows
>> systems).
>>
>> I resolve the path of the dll in my webapp:
>> String win32com = new
>> File(this.getClass().getClassLoader().getResource("win32com.dll").toURI()).getPath();
>>
>> Now, I add the path to the java.library.path property:
>> System.setProperty("java.library.path",
>> System.getProperty("java.library.path") + File.pathSeparator + win32com);
> 
> It looks like you are adding the path to the DLL /including/ the
> filename. I believe that you want to include the path but /not/ the
> filename.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFFgqyB9CaO5/Lv0PARAoyvAKCmbNynmnBsJWAtLDDS04A1cCRAfgCfRSwA
> 8JSVeCm3CH3bkmA+yrfk6/4=
> =suZt
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 

-- 

Abid Hussain
Mail: abid.hussain@abid76.de
Web: http://www.abid76.de

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: using a dll in a webapp

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Abid,

Abid Hussain wrote:
> I want to establish a connection to a serial port from my webapp by
> using the javax.comm package which uses the win32com.dll (on windows
> systems).
> 
> I resolve the path of the dll in my webapp:
> String win32com = new
> File(this.getClass().getClassLoader().getResource("win32com.dll").toURI()).getPath();
> 
> Now, I add the path to the java.library.path property:
> System.setProperty("java.library.path",
> System.getProperty("java.library.path") + File.pathSeparator + win32com);

It looks like you are adding the path to the DLL /including/ the
filename. I believe that you want to include the path but /not/ the
filename.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFgqyB9CaO5/Lv0PARAoyvAKCmbNynmnBsJWAtLDDS04A1cCRAfgCfRSwA
8JSVeCm3CH3bkmA+yrfk6/4=
=suZt
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org