I'm trying to implement a simple HelloWorld application with JNI. To call the c function from Java. I created a java class:
class HelloWorld{
private native void print();
public static void main(String[] args){
new HelloWorld().print();
}
static{
System.load("c://jni_training//HelloWorld.dll");
}
}
then generated a .h file, created c implementation and successfuly generated the .dll. But I cannot execute java HelloWorld...I see exception
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\jni_training\Hello World.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1928)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at HelloWorld.<clinit>(HelloWorld.java:10
What the issue?