JNI Problem

9

9GB

Well, I am having a little trouble compiling my file and generating
header files through it. I am loading a DLL file in Test1.java and
then I compile it this way and get the following message:

javac Test1
javah -jni Test1
error: cannot access Test1
file Test1.class not found
javadoc: error - Class Test1 not found.
Error: No classes were specified on the command line. Try -help.


Can anybody tell me whats the problem with this?
 
G

Gordon Beaton

javac Test1
javah -jni Test1
error: cannot access Test1
file Test1.class not found
javadoc: error - Class Test1 not found.
Error: No classes were specified on the command line. Try -help.

Try specifying -classpath when you run javah (and apparently javadoc).

It isn't necessary to specify -jni.

/gordon

--
 
9

9GB

I added classpath to it, and now I get this message:
C:\R>javah -classpath C:\R InvokeMasterCom
error: cannot access InvokeMasterCom
bad class file: C:\R\InvokeMasterCom.class
class file contains wrong class: RegistrationSystem.InvokeMasterCom
Please remove or make sure it appears in the correct subdirectory of
the classpa
th.
com.sun.tools.javac.util.Abort
at com.sun.tools.javac.comp.Check.completionError(Check.java:
169)
at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:149)
at com.sun.tools.javadoc.RootDocImpl.<init>(RootDocImpl.java:
77)
at
com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:156
)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:330)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:66)
at com.sun.tools.javah.Main.main(Main.java:147)
javadoc: error - fatal error
2 errors
 
9

9GB

Oops! sorry, its fixed now...
Thanks :)

I added classpath to it, and now I get this message:
C:\R>javah -classpath C:\R InvokeMasterCom
error: cannot access InvokeMasterCom
bad class file: C:\R\InvokeMasterCom.class
class file contains wrong class: RegistrationSystem.InvokeMasterCom
Please remove or make sure it appears in the correct subdirectory of
the classpa
th.
com.sun.tools.javac.util.Abort
at com.sun.tools.javac.comp.Check.completionError(Check.java:
169)
at com.sun.tools.javadoc.DocEnv.loadClass(DocEnv.java:149)
at com.sun.tools.javadoc.RootDocImpl.<init>(RootDocImpl.java:
77)
at
com.sun.tools.javadoc.JavadocTool.getRootDocImpl(JavadocTool.java:156
)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:330)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:66)
at com.sun.tools.javah.Main.main(Main.java:147)
javadoc: error - fatal error
2 errors
 
9

9GB

But anyway, just a question, why do we explicitly have to specify the
classpath for it?
 
G

Gordon Beaton

But anyway, just a question, why do we explicitly have to specify the
classpath for it?

Because the argument to javah, java and many other tools in the JDK,
is a classname, not a filename. You need to tell it how to resolve the
classname in order to find the file.

/gordon

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,470
Messages
2,571,807
Members
48,797
Latest member
PeterSimpson
Top