Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNI

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tel me why this dosent work, i have to classes:
Class 1:
public class Cmethods {

public native void AttachToServer();
}
Class 2:
public class RPCClient {
public static void main(String[] args) {
System.out.println("Indl�ser maskin kode");
try {
System.loadLibrary("MML32DLL.dll");
} catch (Error e) {
System.out.println("Fejl ved indl�sning af maskinkode: " + e);
System.exit(1);
}
System.out.println("Opretter objekt.");
Cmethods objekt = new Cmethods();
System.out.println("Kalder metode implementeret i maskinkode.");
objekt.AttachToServer();
System.out.println("lige efter kald til attach");
}
}
I call my program from the dos prompt:
java -Djava.libary.path=. -classpath . RPCClient
I get this exception:
java.lang.UnsatisfiedLinkError: no MML32DLL.dll in java.library.path
I don�t understand this exception, becouse my Dll is in the same path as my class files in the directory, where im running my application, and i got the libary.path ???
Help !!!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I believe the problem is that you're not supposed to include the ".dll" here -- i.e., use just
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YEHHHHHH, your the best !

In all the examples i saw at google and other places, the .ddl was in the code....
But it works without the .ddl
Thanks a lot !
 
Scott Ding
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh, I must remember it.
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it Possible to pass some arguments to that method like given below.
<B>public native void AttachToServer(String str);</B>
If then that C function also has to take the same String as a parameter.
Thanks.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic