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]
# 1

> 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?

GenericTrolla at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 2

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

siramymaa at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 3
I have the same error
forsoft33a at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 4
Don't know, why the bug is still under process since a year: look about this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5070898
lafaunea at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 5
If you are in the directory where your class is: try this, it worksjavah -classpath "." dehexTest
lafaunea at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 6
Sorry,I just did not see your answer.I'll just test javah -classpath "." dehexTest and then confirm you if it works for me.Marc
marcsiramya at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 7
I had tried in following ways it works:1. javac dehexTest.java2. javah -jni dehexTestboth commands are successfully works and create dehexTest.h file.
rajesh_sana at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 8

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

khifaa at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...
# 9

> 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.

jschella at 2007-7-11 2:15:58 > top of Java-index,Developer Tools,Java Compiler...