Hello i now this is basic and i hope some one helps please read.
Sample #1
--> Start
//this is a
java code that calls the JNI to print "Hello World"
class HelloWorld {
static {
//System.loadLibrary("HelloWorld");
System.load("C:/HelloWorld.dll");
}
private native void print();
public static void main(
String[] args) {
new HelloWorld().print();
}
}
#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"
JNIEXPORT void JNICALL
Java_HelloWorld_print(JNIEnv *env, jobject obj)
{
printf("Hello Java Native Interface.\n");
return;
}
--> End
And i want to do is that java will get the value of string variables from JNI and it will print hello world. for example in using java like this.
Sample #2
--> Start
public class classOne {
public static void main(String[]args){
String stringfrom_classTwo = classTwo.pblic_static_str();
System.out.println(stringfrom_classTwo);
}
}
// how to convert classTwo into a JNI?
public class classTwo {
public static String public_static_str(){
String str = "Hello World";
return str;
}
}
--> End