Beginning JNI
Using java version 1.5.0_02, I am attempting to use the JNI for the first time. I have a simple java class called dehexTest.java:
class dehexTest{
publicnativevoid dehexMain();
static
{
System.loadLibrary("dehexTest");
}
publicstaticvoid main(String[] args)
{
new dehexTest().dehexMain();
}
}
I use the command line Java compiler, and I have successfully compiled the class:
javac dehexTest.java
Then proceed to create the header file, this is where I run into problems:
javah -jni dehexTest
I get the following errors:
javadoc: warning - Multiple sources of package comments found for package ""
error: cannot access dehexTest
file dehexTest.class not found
javadoc: error - Class dehexText not found
Error: No classes were specified on the command line
The dehexTest.class file IS for sure in the same directory.
Any ideas on what might be wrong?
[1479 byte] By [
ragoo23a] at [2007-10-1 17:26:25]

> javah -jni dehexTest
>
> I get the following errors:
>
> javadoc: warning - Multiple sources of package
> comments found for package ""
> error: cannot access dehexTest
> file dehexTest.class not found
> javadoc: error - Class dehexText not found
> Error: No classes were specified on the command line
javadoc errors? Are you sure this is the correct error message?
Hi,
I don't understand what happens because I've just obtained the same error as you when studying the Sun Java JNI Tutorial.
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode)
System : Windows 2000 Pro (service pack 4 I think).
Also I've just tried the same command on a Linux Mandrake 2005 LE, with just the same java version, and the javah command just did this job ?
Is there someone here can give me a light ?
Marc
helo. i also get that error when trying to create header. can anyone please tell me how to solve this. i look at this error for the whole week. i have edit the path.
my error is
D:\hani\JNIJava>javah -jni Hello
error: cannot access Hello
file Hello.class not found
javadoc: error - Class Hello not found.
Error: No classes were specified on the command line. Try -help.
i save the Hello. class in JNIJava folder.
hope to hear from you soon. your help are very appreciated. thank you
> helo. i also get that error when trying to create
> header. can anyone please tell me how to solve this.
> i look at this error for the whole week. i have edit
> the path.
>
> my error is
>
> D:\hani\JNIJava>javah -jni Hello
> error: cannot access Hello
> file Hello.class not found
> javadoc: error - Class Hello not found.
> Error: No classes were specified on the command line.
> Try -help.
>
> i save the Hello. class in JNIJava folder.
>
> hope to hear from you soon. your help are very
> appreciated. thank you
There is a JNI forum.
The error you are getting doesn't appear to be the same as the others discussed.
The error is quite clear. It can find the file. As a guess you have mucked with the env CLASSPATH or the file isn't there.