File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Jni help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Jni help" Watch "Jni help" New topic
Author

Jni help

prem marimuthu
Greenhorn

Joined: Jul 24, 2008
Posts: 2
Hi All,
May i know how to create c header file using java jni for a class which is inside a jar file.
I have created a jar called HelloWorld.jar (using Netbeans) which has only class file as below


i tried following command

javah -jni HelloWorld
i am getting below error
error: cannot access HelloWorld
class file for HelloWorld not found

javah -jni example.HelloWorld
i am getting below error
error: cannot access HelloWorld
class file for HelloWorld not found

Please let me know how to create the c header file.

Regards,
Prem
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
That class file (or the jar file that contains it) don't seem to be in the classpath when you run the "javah" command.
prem marimuthu
Greenhorn

Joined: Jul 24, 2008
Posts: 2
Hi,
Ulf Dittmer Thanks for your reply. May i know how to give classpath in javah command. I kindly request the syntax for giving classpath in javah command.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
Typing "javah" on the command line will print out all its options, including how to give the classpath. The JNI tutorial on oracle.com is sure to cover that as well, as, in fact, should any JNI tutorial.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jni help