HI Rob
Thanks for your reply
Accordingly i modified the files
Hello.java******************
public class Hello
{
static
{
System.loadLibrary("hello");
}
public static native Student sayHello();
public static void main(String[] args)
{
Hello p = new Hello();
Student len = p.sayHello();
System.out.println("Name = " + len.name);
System.out.println("Age = " + len.age);
}
public class Student
{
private int age;
private String name;
public Student(int age, String name)
{
this.age = age;
this.name = name;
}
// the rest of the class
}
}
and Hello.c
#include <jni.h>
#include "Hello.h"
#include <stdio.h>
struct student
{
char *name;
int age;
}student1;
JNIEXPORT jobject JNICALL
Java_Hello_sayHello(JNIEnv *env, jclass cls)
{
jmethodID constructor;
jvalue args[2];
jobject object;
cls = (*env)->FindClass(env, "Student");
constructor = (*env)->GetMethodID(env, cls, "<init>", "(ILjava/lang/String

V");
args[0].i = 23;
args[1].l = (*env)->NewStringUTF(env, "Jack");
object = (*env)->NewObjectA(env, cls, constructor, args);
return object;
}
Hello.h
contains
JNIEXPORT jobject JNICALL Java_Hello_sayHello
(JNIEnv *, jclass);
Now when i run the application using java hello
My JVM Crashes
getting the following error messages
"An Unexpected Error has been detected by Hotspot Virtual Machine............"
I dont know where i am doing wrong.please help