You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Xar <ex...@gmail.com> on 2006/02/01 13:11:50 UTC

Problem making a build.xml using javah

Hello.

I am starting a project that combines both java and C code and I need it to
be compiled through ant (because the main aplicattion uses it).

I readed the webpage and what's my surprise to see that only version
1.4supports jni (it's that true? higher versions doesn't support jni?)

Well, i tried to download version 1.4 and again I was surprised when I saw
that its de 1.6.2 (or it promtps it when i do ant -version):

    /usr/software/jakarta-ant-1.4/bin/ant -version
    Apache Ant version 1.6.2 compiled on January 3 2006

Well, i tried to compile this file with this version and the latest one and
this is the result:

    ant
    Buildfile: build.xml

    compile:

    BUILD FAILED
    /home/xar/Proyecto/temp/build.xml:4: Could not create task or type of
type: javah.

    Ant could not find the task or a class this task relies upon.

The build.xml couldn't be shorter:

    <project name="BOI" default="compile" basedir=".">
            <target name="compile">
                    <javac srcdir="." destdir="." nowarn="off" />
                    <javah destdir="." class="HelloWorld" />
            </target>
    </project>

This is a Hello World program to try JNI that compiled separately in command
line works fine.

I apologize for my poor English.

Thank you!

Re: Problem making a build.xml using javah

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 1 Feb 2006, Xar <ex...@gmail.com> wrote:

> I readed the webpage and what's my surprise to see that only version
> 1.4supports jni (it's that true? higher versions doesn't support
> jni?)

Where did you read that?  javah works fine on many versions of Ant (we
had at least one release that was replaced shortly thereafter with a
new one because javah was broken).

> Well, i tried to download version 1.4 and again I was surprised when
> I saw that its de 1.6.2 (or it promtps it when i do ant -version):
> 
>     /usr/software/jakarta-ant-1.4/bin/ant -version
>     Apache Ant version 1.6.2 compiled on January 3 2006

If you have ANT_HOME set and it points to an installed 1.6.2 the
shell script will pick it up instead of 1.4.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Problem making a build.xml using javah

Posted by Steve Loughran <st...@apache.org>.
Xar wrote:



> 
> 2006/2/1, Xar <ex...@gmail.com>:
>> Hello.
>>
>> I am starting a project that combines both java and C code and I need it
>> to be compiled through ant (because the main aplicattion uses it).
>>
>> I readed the webpage and what's my surprise to see that only version 1.4supports jni (it's that true? higher versions doesn't support jni?)
>>
>> Well, i tried to download version 1.4 and again I was surprised when I saw
>> that its de 1.6.2 (or it promtps it when i do ant -version):
>>
>>     /usr/software/jakarta-ant-1.4/bin/ant -version
>>     Apache Ant version 1.6.2 compiled on January 3 2006


What's happening there is that the ant shell file is probably handing 
off to another version, whatever is in ANT_HOME or something jpackage 
installed. ant -diagnostics files more info.

1. Ant1.6 supports javah; please point out the URL where it said "1.4 
only" and we'll fix it to "1.4 or later"
2. you do need ant-optional.jar with the javah task in it.

>>     BUILD FAILED
>>     /home/xar/Proyecto/temp/build.xml:4: Could not create task or type of
>> type: javah.
>>
>>     Ant could not find the task or a class this task relies upon.
>>
>> The build.xml couldn't be shorter:
>>
>>     <project name="BOI" default="compile" basedir=".">
>>             <target name="compile">
>>                     <javac srcdir="." destdir="." nowarn="off" />
>>                     <javah destdir="." class="HelloWorld" />
>>             </target>
>>     </project>
>>

run in -v mode for better diagnostics, perhaps.

Like Thomas says, once you start trying to compile the c++ code, you'll 
need the relevant tasks from ant-contrib.sf.net

-steve


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Problem making a build.xml using javah

Posted by Thomas Burdairon <tb...@entelience.com>.
try cpptasks from ant contrib which works great for jni.

Thomas

On Feb 9, 2006, at 10:45 AM, Xar wrote:

> Eeem, no one knows the answer to my question or my mails didn't  
> arrive?
>
> 2006/2/1, Xar <ex...@gmail.com>:
>>
>> Hello.
>>
>> I am starting a project that combines both java and C code and I  
>> need it
>> to be compiled through ant (because the main aplicattion uses it).
>>
>> I readed the webpage and what's my surprise to see that only  
>> version 1.4supports jni (it's that true? higher versions doesn't  
>> support jni?)
>>
>> Well, i tried to download version 1.4 and again I was surprised  
>> when I saw
>> that its de 1.6.2 (or it promtps it when i do ant -version):
>>
>>     /usr/software/jakarta-ant-1.4/bin/ant -version
>>     Apache Ant version 1.6.2 compiled on January 3 2006
>>
>> Well, i tried to compile this file with this version and the  
>> latest one
>> and this is the result:
>>
>>     ant
>>     Buildfile: build.xml
>>
>>     compile:
>>
>>     BUILD FAILED
>>     /home/xar/Proyecto/temp/build.xml:4: Could not create task or  
>> type of
>> type: javah.
>>
>>     Ant could not find the task or a class this task relies upon.
>>
>> The build.xml couldn't be shorter:
>>
>>     <project name="BOI" default="compile" basedir=".">
>>             <target name="compile">
>>                     <javac srcdir="." destdir="." nowarn="off" />
>>                     <javah destdir="." class="HelloWorld" />
>>             </target>
>>     </project>
>>
>> This is a Hello World program to try JNI that compiled separately in
>> command line works fine.
>>
>> I apologize for my poor English.
>>
>> Thank you!
>>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Problem making a build.xml using javah

Posted by Xar <ex...@gmail.com>.
Well, i've resolved my problem with the mailing list and fortunatelly I
resolved the problem with ant. It was a problem with my gentoo that (and i
don't know) have installed some libraries but emerge sais it isn't. I
emerged it and the problem is gone.

Thank you all!!

2006/2/9, Xar <ex...@gmail.com>:
>
> Eeem, no one knows the answer to my question or my mails didn't arrive?
>
> 2006/2/1, Xar <ex...@gmail.com>:
> >
> > Hello.
> >
> > I am starting a project that combines both java and C code and I need it
> > to be compiled through ant (because the main aplicattion uses it).
> >
> > I readed the webpage and what's my surprise to see that only version 1.4supports jni (it's that true? higher versions doesn't support jni?)
> >
> > Well, i tried to download version 1.4 and again I was surprised when I
> > saw that its de 1.6.2 (or it promtps it when i do ant -version):
> >
> >     /usr/software/jakarta-ant-1.4/bin/ant -version
> >     Apache Ant version 1.6.2 compiled on January 3 2006
> >
> > Well, i tried to compile this file with this version and the latest one
> > and this is the result:
> >
> >     ant
> >     Buildfile: build.xml
> >
> >     compile:
> >
> >     BUILD FAILED
> >     /home/xar/Proyecto/temp/build.xml:4: Could not create task or type
> > of type: javah.
> >
> >     Ant could not find the task or a class this task relies upon.
> >
> > The build.xml couldn't be shorter:
> >
> >     <project name="BOI" default="compile" basedir=".">
> >             <target name="compile">
> >                     <javac srcdir="." destdir="." nowarn="off" />
> >                     <javah destdir="." class="HelloWorld" />
> >             </target>
> >     </project>
> >
> > This is a Hello World program to try JNI that compiled separately in
> > command line works fine.
> >
> > I apologize for my poor English.
> >
> > Thank you!
> >
>
>

Re: Problem making a build.xml using javah

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 9 Feb 2006, Xar <ex...@gmail.com> wrote:

> Eeem, no one knows the answer to my question or my mails didn't
> arrive?

Maybe you should subscribe to the mailing list if you want to see the
answers?  I answered your post about a week ago
<http://marc.theaimsgroup.com/?l=ant-user&m=113885794508975&w=2>.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Problem making a build.xml using javah

Posted by Xar <ex...@gmail.com>.
Eeem, no one knows the answer to my question or my mails didn't arrive?

2006/2/1, Xar <ex...@gmail.com>:
>
> Hello.
>
> I am starting a project that combines both java and C code and I need it
> to be compiled through ant (because the main aplicattion uses it).
>
> I readed the webpage and what's my surprise to see that only version 1.4supports jni (it's that true? higher versions doesn't support jni?)
>
> Well, i tried to download version 1.4 and again I was surprised when I saw
> that its de 1.6.2 (or it promtps it when i do ant -version):
>
>     /usr/software/jakarta-ant-1.4/bin/ant -version
>     Apache Ant version 1.6.2 compiled on January 3 2006
>
> Well, i tried to compile this file with this version and the latest one
> and this is the result:
>
>     ant
>     Buildfile: build.xml
>
>     compile:
>
>     BUILD FAILED
>     /home/xar/Proyecto/temp/build.xml:4: Could not create task or type of
> type: javah.
>
>     Ant could not find the task or a class this task relies upon.
>
> The build.xml couldn't be shorter:
>
>     <project name="BOI" default="compile" basedir=".">
>             <target name="compile">
>                     <javac srcdir="." destdir="." nowarn="off" />
>                     <javah destdir="." class="HelloWorld" />
>             </target>
>     </project>
>
> This is a Hello World program to try JNI that compiled separately in
> command line works fine.
>
> I apologize for my poor English.
>
> Thank you!
>