Hi guys i have tried all the solutions like java -Djava.library.path=. demo adding the dll path to PATH java -Djava.library.path=c:\JNI\demo.dll demo
But still the above error.
Here is my java code..
class demo
{
public native void printline();
public static void main(String[]args)
{
new demo().printline();
}
}
Here is my c code...
#include<stdio.h>
#include<jni.h>
#include "demo.h"
JNIEXPORT void JNICALL Java_demo_printline(JNIEnv *a, jobject b)
{
printf("Hello wrold!!!");
return;
}
Steps for compiling and running,
- javac demo.java
- javah demo
- gcc -c -I"c:\jdk1.7.0_55\include" -I"c:\jdk1.7.0_55\include\win32" demo.c
- gcc -Wl,--add-stdcall-alias -shared -o demo.dll demo.c
- java -Djava.library.path=c:\JNI\demo.dll demo
Am i going wrong somewhere?
can someone please help me out,.
printfwhich caused the big side effects ( writing on stdout buffer ) . Are you sure that JVM doesnt eliminate this kind of actions? - Amir Naghizadeh