File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Not able to find .dll file in my java path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Not able to find .dll file in my java path" Watch "Not able to find .dll file in my java path" New topic
Author

Not able to find .dll file in my java path

Sindhura Lakshmi
Greenhorn

Joined: Jun 18, 2009
Posts: 13
Hi ,


I am using JNI concept for writing data into an image .I was able to do this using a normal java class(Java Project).
Now i was trying to integrate it into my webproject.when i am invoking my method it is not able to load the native library .
I am getting the following exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no chilkat in java.library.path

Can i add the dll file in any of the jars ?How can i do this?Please help .

Thanks
Sindhura


Prashant Hurria
Ranch Hand

Joined: Mar 23, 2009
Posts: 40
The .dll files will not be picked from the class path.
You can set the enviornment variable java.library.path=<Path Of Files >
eg if your dlls are ket in the folder /home/nagarro/official/jNotify/jnotify-lib-0.93 you can set it as java.library.path=/home/nagarro/official/jNotify/jnotify-lib-0.93
alternativally you can also run it like this java -Djava.library.path=/home/nagarro/official/jNotify/jnotify-lib-0.93
Sindhura Lakshmi
Greenhorn

Joined: Jun 18, 2009
Posts: 13
Thanks Prashanth

But how i can keep my dll file in my web project , so that doesnt give any exception when we run it on any another machine.
I understood that we should set it in the path .But how can i include it in my application without setting it every time.
Prashant Hurria
Ranch Hand

Joined: Mar 23, 2009
Posts: 40
I think what will work is that before you deploy the application set the java.library.path as an environment variable.
Sindhura Lakshmi
Greenhorn

Joined: Jun 18, 2009
Posts: 13
Yes if i put it in my java path it works fine.But when my application will be deployed on a linux server where can i include this .dll.
Prashant Hurria
Ranch Hand

Joined: Mar 23, 2009
Posts: 40
Set it as an Enviornment variable like this
SET java.library.path=Path of your DLL
Sindhura Lakshmi
Greenhorn

Joined: Jun 18, 2009
Posts: 13
I want my dll file to be available at runtime to the application.As suggested if i place in the java .library path in environmental variables it works only on my system but i think it does not work on all platforms i.e if i deploy the application on linux server.
Prashant Hurria
Ranch Hand

Joined: Mar 23, 2009
Posts: 40
I am afraid that is the only way.At least what I know of. I could not find anything else. You can try entering information in Manifest file or something like that. Once i made it work the way i mentioned above i didint try much as I didnt need.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19791
    
  20

You can't use DLL files in Linux, but the java.library.path variable works on all systems. The only difference is that in Linux you will need to use : instead of ; between two folders.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Prashant Hurria
Ranch Hand

Joined: Mar 23, 2009
Posts: 40
Rob Prime wrote:You can't use DLL files in Linux, but the java.library.path variable works on all systems. The only difference is that in Linux you will need to use : instead of ; between two folders.

Exactly .... for Linux you need a equivalent of the .dll and that would be a .so file. Most distributions include a .dll and a .so file. For example popular opensource projects using JNI like jnotify provide you with both a .dll filefor windows and a .so file for linux
Srinivas Kothuri
Greenhorn

Joined: Feb 08, 2010
Posts: 17
Hi, i too was facing the same problem but is resolved by adding the folder path (containing my dll) to PATH env. variable on windows.
but now the message for exception is changed to

Exception in thread "main" java.lang.UnsatisfiedLinkError: NativeClass.nativeMethod(I)I
at NativeClass.nativeMethod(Native Method)
at NativeClass.<init>(NativeClassClass.java:17)
at NativeClassTest.main(NativeClassTest.java:14)


please notice that NativeClass.java is containing my native method and NativeClassTest.java is the class to contain my main() method.
If the dll is not properly formed, how can I find it.
how would i know that System.loadLibrary ("mydll"); is failed?

kindly give me some clues . ..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to find .dll file in my java path