Welcome to Dream.In.Code
Become a Java Expert!

Join 150,416 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,015 people online right now. Registration is fast and FREE... Join Now!




Generate jni header file in eclipse

 
Reply to this topicStart new topic

Generate jni header file in eclipse

yannick
31 Mar, 2008 - 12:28 AM
Post #1

New D.I.C Head
*

Joined: 24 Oct, 2007
Posts: 9


My Contributions
Hi, can anyone help me in generating jni header file within/or with a project created with eclipse with the following path:
D:\workspace\DLLImportExample\src\com\dll\JNICom.java

When I'm trying to create the header file using javah -jni JNIComm, it's giving the following error:
D:\workspace\DLLImportExample\src\com\dll>javah -jni JNIComm
error: cannot access JNIComm
bad class file: .\JNIComm.class
class file contains wrong class: com.dll.JNIComm
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:164)
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:159
)
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

D:\workspace\DLLImportExample\src\com\dll>

When I remove the package com.dll and set the default package, the javah -jni command runns successfully. Can you help me overcome the issue of package when running javah -jni.
Thanks

This post has been edited by yannick: 31 Mar, 2008 - 12:33 AM
User is offlineProfile CardPM
+Quote Post

pbl
RE: Generate Jni Header File In Eclipse
31 Mar, 2008 - 08:49 AM
Post #2

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions

This is a good link from University of Manitoba Computer Science Department

http://www.cs.umanitoba.ca/~eclipse/8-JNI.pdf
User is offlineProfile CardPM
+Quote Post

yannick
RE: Generate Jni Header File In Eclipse
1 Apr, 2008 - 01:25 AM
Post #3

New D.I.C Head
*

Joined: 24 Oct, 2007
Posts: 9


My Contributions
Thanks for the link, it's very interesting!

This post has been edited by yannick: 1 Apr, 2008 - 01:30 AM
User is offlineProfile CardPM
+Quote Post

yannick
RE: Generate Jni Header File In Eclipse
2 Apr, 2008 - 03:52 AM
Post #4

New D.I.C Head
*

Joined: 24 Oct, 2007
Posts: 9


My Contributions
QUOTE(yannick @ 1 Apr, 2008 - 02:25 AM) *

Thanks for the link, it's very interesting!


Hi, an other question is why javah -jni <classname> doesn't work if a package is specified in the class such as "package com.xxx.yyy;" (in eclipse), but if the package is set to the default, it's running without error.
User is offlineProfile CardPM
+Quote Post

yannick
RE: Generate Jni Header File In Eclipse
3 Apr, 2008 - 06:19 AM
Post #5

New D.I.C Head
*

Joined: 24 Oct, 2007
Posts: 9


My Contributions
Hi, an other question is why javah -jni <classname> doesn't work if a package is specified in the class such as "package com.xxx.yyy;" (in eclipse), but if the package is set to the default, it's running without error.
[/quote]

Hi, the solution to the question above is the link below:
www.rgagnon.com/javadetails/java-0348.html

wink2.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:05PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month