JNI - javah fail to compiles?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Sunday, May 23, 2004 03:30 AM

I had 1 question. I try to compile my java code with javac, it works fine. But i try to do this: javah Sample1 or javah -jni Sample1 it shows this error: C:Documents and Settingswcchua>javah C:JNITestSample1 Error: Class C:JNITestSample1 could not be found. Below are my codes extracted from a tutorial: public class Sample1 { public native int intMethod(int n); public native boolean booleanMethod(boolean bool); public native String stringMethod(String text); public native int intArrayMethod(int[] intArr   More>>


I had 1 question. I try to compile my java code with javac, it works fine.


But i try to do this:


javah Sample1


or


javah -jni Sample1


it shows this error:


C:Documents and Settingswcchua>javah C:JNITestSample1
Error: Class C:JNITestSample1 could not be found.


Below are my codes extracted from a tutorial:


public class Sample1 {


public native int intMethod(int n);


public native boolean booleanMethod(boolean bool);


public native String stringMethod(String text);


public native int intArrayMethod(int[] intArray);



public static void main(String[] args)


{


System.loadLibrary("Sample1");


Sample1 sample = new Sample1();


int square = sample.intMethod(5);


boolean bool = sample.booleanMethod(true);


String text = sample.stringMethod("JAVA");


int sum = sample.intArrayMethod(new int[] {1,1,2,3,5,8,13
});


System.out.println("intMethod: " + square);


System.out.println("booleanMethod: " + bool);


System.out.println("stringMethod: " + text);


System.out.println("intArrayMethod: " + sum);


}


}


Any idea, why i can't generate a h file?


Thanks.

   <<Less

Re: JNI - javah fail to compiles?

Posted By:   ein_achim  
Posted On:   Wednesday, July 14, 2004 07:33 AM

try "javah -classpath . -jni Sample1"
About | Sitemap | Contact