Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Almas Akhtar   on Aug 14 In Java Category.

  
Question Answered By: Jamie Roberts   on Aug 14

You can refer to JNI tutorial on sun web site.
Fitsr load library.
Then call  the required method.
Take acre the the dll  must be in path OR keep it in Win32 folder of system


public class Test {
// Load the dll that exports functions callable from java
static {System.loadLibrary("TestImp");}

// Imported function declarations
public native void print(String msg);

public void Test() {
}
public static void main (String ar[]){


Test t = new Test();
// Printf example
t.print("->Testing JNI - Hello from java  to c++\n");

}
}

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

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


Tagged: