Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Call DLL method

  Asked By: Kevin    Date: Jun 05    Category: Java    Views: 2203
  

How i can call in java a method from a .dll file. for example postmessage for send message to process. I use System.loadLibrary("dllname") and then "native" declare of method: public static native methodName...
but an error occured:java.lang.UnsatisfiedLinkError

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Cyka Jansen     Answered On: Jun 05

my suggestions:

1. make sure DLL is in PATH
2. avoid name mangeling in the DLL (the methods that you are calling)
3. make sure DLL does not have other dependencies or if it does, all are accessible.
4. make sure DLL is generated and linked for the host platform (the one that you are trying to load it on)

Question: If you comment out the native method  call, do you still get the exception (does it occure on the load time)? or it only happens when you call  the native  method? - the answer should show you the solution

 
Answer #2    Answered By: Robin Hayes     Answered On: Jun 05

do one the following:
1) put dll  in the path
2) put dll in root folder of application, and make sure you are
calling application jar file  from the same directory
3) read jar spec and put dll in jar, with your class files according
to given instructions.

 
Didn't find what you were looking for? Find more on Call DLL method Or get search suggestion and latest updates.




Tagged: