Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

JNI Problem

Thread view: 
9GB - 07 Jul 2007 19:01 GMT
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?
Gordon Beaton - 07 Jul 2007 19:16 GMT
> 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

--
9GB - 07 Jul 2007 19:30 GMT
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

> > javac Test1
> > javah -jni Test1
[quoted text clipped - 10 lines]
>
> --
9GB - 07 Jul 2007 19:31 GMT
Oops! sorry, its fixed now...
Thanks :)

> I added classpath to it, and now I get this message:
> C:\R>javah -classpath C:\R InvokeMasterCom
[quoted text clipped - 34 lines]
>
> > --
9GB - 07 Jul 2007 19:32 GMT
But anyway, just a question, why do we explicitly have to specify the
classpath for it?

> I added classpath to it, and now I get this message:
> C:\R>javah -classpath C:\R InvokeMasterCom
[quoted text clipped - 34 lines]
>
> > --
Gordon Beaton - 07 Jul 2007 20:13 GMT
> 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

--
Roedy Green - 08 Jul 2007 18:28 GMT
>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:

You can do it with ANT.  See a sample ant script at
http://mindprod.com/products.html#FILETIMES
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.