You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Gregory A. Payne" <kg...@earthlink.net> on 2001/02/06 00:43:15 UTC
Java task on Linux
Hello,
Trying to use Ant 1.2 with JUnit 3.5 on Linux using the java task. I
haevn't tried using the junit task because the documentation says this
won't work with JUnit 3.5. I am trying to get the examples from the
following article to work:
http://www-106.ibm.com/developerworks/library/j-ant/?dwzone=java
With the sample code for the article at:
ftp://www6.software.ibm.com/software/developer/library/antsample.zip
The problem seems to be with the "fork" property in the runtests target:
<target name="runtests" depends="compiletests" if="junit.present">
<java fork="yes" classname="junit.textui.TestRunner"
taskname="junit" failonerror="true">
<arg value="test.com.company.AllJUnitTests"/>
<classpath>
<pathelement location="build/lib/${app.name}.jar" />
<pathelement location="build/testcases" />
<pathelement path="" />
<pathelement path="${java.class.path}" />
</classpath>
</java>
</target>
I have tested this with JDK 1.2.2 and JDK 1.3 and it works fine with
fork="no". When set to fork="yes" (which the sample code uses), I get:
Searching for build.xml ...
Buildfile: /home/greg/antjunit/sample/build.xml
JUNIT:
compile:
jar:
compiletests:
runtests:
BUILD FAILED
/home/greg/antjunit/sample/build.xml:41: java.io.IOException: java:
cannot execute
java.io.IOException: java: cannot execute
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:137)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java)
at org.apache.tools.ant.taskdefs.Java.run(Java.java)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java)
at org.apache.tools.ant.Target.execute(Target.java)
at org.apache.tools.ant.Project.runTarget(Project.java)
at org.apache.tools.ant.Project.executeTarget(Project.java)
at org.apache.tools.ant.Project.executeTargets(Project.java)
at org.apache.tools.ant.Main.runBuild(Main.java)
at org.apache.tools.ant.Main.main(Main.java)
Any help is appreciated.
Thanks,
Greg
Re: Java task on Linux
Posted by Diane Holt <ho...@yahoo.com>.
Could it be picking up a weird 'java' from your $PATH... out of curiosity,
what happens if you include the "jvm" attribute, giving it the full-path
to, say, your jdk13 'java'?
Diane
--- "Gregory A. Payne" <kg...@earthlink.net> wrote:
> Hello,
>
> Trying to use Ant 1.2 with JUnit 3.5 on Linux using the java task. I
> haevn't tried using the junit task because the documentation says this
> won't work with JUnit 3.5. I am trying to get the examples from the
> following article to work:
>
> http://www-106.ibm.com/developerworks/library/j-ant/?dwzone=java
>
> With the sample code for the article at:
>
> ftp://www6.software.ibm.com/software/developer/library/antsample.zip
>
> The problem seems to be with the "fork" property in the runtests target:
>
> <target name="runtests" depends="compiletests" if="junit.present">
> <java fork="yes" classname="junit.textui.TestRunner"
> taskname="junit" failonerror="true">
> <arg value="test.com.company.AllJUnitTests"/>
> <classpath>
> <pathelement location="build/lib/${app.name}.jar" />
> <pathelement location="build/testcases" />
> <pathelement path="" />
> <pathelement path="${java.class.path}" />
> </classpath>
> </java>
> </target>
>
> I have tested this with JDK 1.2.2 and JDK 1.3 and it works fine with
> fork="no". When set to fork="yes" (which the sample code uses), I get:
>
> Searching for build.xml ...
> Buildfile: /home/greg/antjunit/sample/build.xml
>
> JUNIT:
>
> compile:
>
> jar:
>
> compiletests:
>
> runtests:
>
> BUILD FAILED
>
> /home/greg/antjunit/sample/build.xml:41: java.io.IOException: java:
> cannot execute
> java.io.IOException: java: cannot execute
> at java.lang.UNIXProcess.forkAndExec(Native Method)
> at java.lang.UNIXProcess.<init>(UNIXProcess.java:137)
> at java.lang.Runtime.execInternal(Native Method)
> at java.lang.Runtime.exec(Runtime.java:551)
> at java.lang.reflect.Method.invoke(Native Method)
> at
>
org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java)
>
> at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java)
> at org.apache.tools.ant.taskdefs.Java.run(Java.java)
> at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java)
> at org.apache.tools.ant.taskdefs.Java.execute(Java.java)
> at org.apache.tools.ant.Target.execute(Target.java)
> at org.apache.tools.ant.Project.runTarget(Project.java)
> at org.apache.tools.ant.Project.executeTarget(Project.java)
> at org.apache.tools.ant.Project.executeTargets(Project.java)
> at org.apache.tools.ant.Main.runBuild(Main.java)
> at org.apache.tools.ant.Main.main(Main.java)
>
> Any help is appreciated.
>
> Thanks,
>
> Greg
=====
(holtdl@yahoo.com)
__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/