Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JNI: Can't generated header 1

Status
Not open for further replies.

YerMom

Programmer
Oct 3, 2006
127
US
I'm using javah to generate header file on windows XP. I'm using a batch file to start javah. Here is the contents of the batch file:

Code:
javah -verbose -classpath . -jni com.mycompany.doctools.apireferencecompares.TestFrameScript >> BuildHeaderLog.txt  2>&1

The batch file is in the directory where the TestFrameScript.class file is located. The directory is:

Code:
D:\D_LocalWork\CCBS\Doc_Tools\EclipseDocTools\bin\com\mycompany\doctools\apireferencecompares

In the Java source file, the package name is:

Code:
package com.mycompany.doctools.apireferencecompares;


When I run javah, I get the error shown below.

It looks like javah is not looking in the correct directory, even though I've included a -classpath in my command line invocation.
I'm not sure what's wrong. Can anyone help?

Thanks.

Code:
error: cannot access com.mycompany.doctools.apireferencecompares.TestFrameScript
file com\mycompany\doctools\apireferencecompares\TestFrameScript.class not found
javadoc: error - Class com.mycompany.doctools.apireferencecompares.TestFrameScript not found.
[ Search Path: D:\D_ProgramFiles\java\jdk1.5.0_06\jre\lib\rt.jar;D:\D_ProgramFiles\java\jdk1.5.0_06\jre\lib\i18n.jar;D:\D_ProgramFiles\java\jdk1.5.0_06\jre\lib\sunrsasign.jar;D:\D_ProgramFiles\java\jdk1.5.0_06\jre\lib\jsse.jar;D:\D_ProgramFiles\java\jdk1.5.0_06\jre\lib\jce.jar;D:\D_ProgramFiles\java\jdk1.5.0_06\jre\lib\charsets.jar;D:\D_ProgramFiles\java\jdk1.5.0_06\jre\classes\. ]
Error: No classes were specified on the command line.  Try -help.

The listing of the directory shows that TestFrameScript.class is indeed in the directory:
Code:
 Directory of D:\D_LocalWork\CCBS\Doc_Tools\EclipseDocTools\bin\com\mycompany\doc
tools\apireferencecompares

08/27/2009  07:40 AM    <DIR>          .
08/27/2009  07:40 AM    <DIR>          ..
08/27/2009  07:40 AM               199 BuildHeader.bat
08/27/2009  07:40 AM               713 BuildHeaderLog.txt
08/26/2009  06:35 AM             4,465 Dashboard.class
12/29/2005  12:58 PM            49,152 DashBoard.dll
08/27/2009  06:42 AM             2,136 FrameScript.class
08/24/2009  11:54 AM             3,067 InputParameter.class
08/24/2009  11:57 AM             1,021 InputParamTest.class
08/26/2009  06:24 AM             1,134 JEditorPaneDescriptionTemplate.class
08/26/2009  07:39 AM    <DIR>          jni
08/24/2009  11:58 AM             2,819 ParamPrettyPrinter.class
08/27/2009  07:13 AM               804 TestFrameScript.class
08/24/2009  12:00 PM             2,970 TestStaxXmlReader.class
08/24/2009  12:02 PM             8,681 TestXPathXmlReader.class
08/24/2009  02:09 PM             2,941 UniversalNamespaceCache.class
08/11/2009  08:43 AM             3,716 XPathEvaluator.class
08/24/2009  02:10 PM             8,688 XPathXmlReader.class
08/25/2009  09:41 AM             9,256 XPathXmlReader_v2.class
              16 File(s)        101,762 bytes
 
I'd try:

- Doing it from command line to avoid batch errors.
- Execute it from :\D_LocalWork\CCBS\Doc_Tools\EclipseDocTools\bin

Cheers,
Dian
 
Dian,
Thanks -- that works. Do you have any idea why the bat file approach did not work?
 
Because when you execute from command line java expects to be executed from the root of the packages.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top