You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Simeon Fitch <me...@yahoo.com> on 2000/11/14 16:57:59 UTC
Help: Upgrade to JDK 1.3 causes fork to fail
I just upgraded from the Blackdown JDK 1.2.2 to
Blackdown JDK 1.3 FCS for RH6.2 x86. In my build file
I have a target called "run" which launches Antidote,
that looks as follows:
<target name="run" depends="compile"
description="Run Antidote">
<java classname="org.apache.tools.ant.gui.Main"
fork="yes"
dir="${user.home}">
<jvmarg value="-Djava.compiler=NONE"/>
<classpath>
<pathelement location="${build.classes}"/>
<pathelement location="${ant.jar}"/>
</classpath>
</java>
</target>
When I run the target I now get an exception that I'm
not sure how to track down (see below) Any hints would
be appreciated.
$: ant -verbose run
Ant version 1.2 compiled on October 24 2000
Searching for build.xml ...
Searching in /home/sfitch/jakarta-ant/src/antidote
Buildfile:
/home/sfitch/jakarta-ant/src/antidote/build.xml
Detected Java Version: 1.3
Detected OS: Linux
Project base dir set to:
/home/sfitch/jakarta-ant/src/antidote
[property] Loading /home/sfitch/.ant.properties
Build sequence for target `run' is [prepare, compile,
run]
Complete build sequence is [prepare, compile, run,
clean, javadocs, jar]
[copy] Copying 1 files to
/home/sfitch/build/antidote/classes
[copy] Copying
/home/sfitch/jakarta-ant/src/antidote/org/apache/tools/ant/gui/version.txt
to
/home/sfitch/build/antidote/classes/org/apache/tools/ant/gui/version.txt
Copy:
/home/sfitch/jakarta-ant/src/antidote/org/apache/tools/ant/gui/version.txt
>
/home/sfitch/build/antidote/classes/org/apache/tools/ant/gui/version.txt
Replacing: @VERSION@ -> 0.1
Replacing: @DATE@ -> November 14 2000
[java] Forking java -Djava.compiler=NONE
-classpath
/home/sfitch/build/antidote/classes:/home/sfitch/build/ant/lib/ant.jar
org.apache.tools.ant.gui.Main
BUILD FAILED
/home/sfitch/jakarta-ant/src/antidote/build.xml:116:
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:390)
at
org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:247)
at
org.apache.tools.ant.taskdefs.Java.run(Java.java:270)
at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:111)
at
org.apache.tools.ant.taskdefs.Java.execute(Java.java:86)
at
org.apache.tools.ant.Target.execute(Target.java:142)
at
org.apache.tools.ant.Project.runTarget(Project.java:818)
at
org.apache.tools.ant.Project.executeTarget(Project.java:532)
at
org.apache.tools.ant.Project.executeTargets(Project.java:506)
at org.apache.tools.ant.Main.runBuild(Main.java:420)
at org.apache.tools.ant.Main.main(Main.java:149)
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/
current working dir in Ant task
Posted by Max Nalsky <ma...@mccme.ru>.
Hello!
Has anyone any ideas on the following problem:
I was trying to invoke Ant task from the build.xml like this:
<target name="autobuild">
<ant dir="subproject" target="test" />
</target>
The target "test" in subproject/build.xml invokes some program which use
current working directory as a base directory of all internal test
files. The problem is that program cannot find some of the files. After
investigation I faced a fact that the missing file is a DLL located inside
my project. This DLL is resolved via "java.library.path" property, which I
honestly substitute while invoking java inside "test" target. BUT! I
substitute it with RELATIVE path which is INCORRECT since current working
directory IS NOT "./subproject", it's ".". That's why I get
UnsatisfiedLinkError exception.
As far as I understand while inside JVM one cannot change working
directory. That's why I thought that forking may help in this case - if we
can fork another VM for building subproject, we could set working dir for
it correctly and it would find DLL. But, Ant task does not support
forking. "Ok", - said I to myself, "this will hardly take more than
several hours to implement forking in Ant.java" and was confused with
a lot of code duplication in ...ant.taskdefs.Ant and ...ant.Main. It even
seems to me that if subproject is invoked with Ant task - it won't receive
a BuildStarted event since there's no such fireBuildStarted invocation in
Ant.java. That's why I decided to ask for your help - maybe I'm missing
something?
Ant gurus! What would you advice me to do if I still would like to make
Ant setting working dir correctly for subprojects?
Thanks in advance,
Max Nalsky
Re: Help: Upgrade to JDK 1.3 causes fork to fail
Posted by Peter Donald <do...@apache.org>.
At 07:57 14/11/00 -0800, you wrote:
> [java] Forking java -Djava.compiler=NONE
>-classpath
>/home/sfitch/build/antidote/classes:/home/sfitch/build/ant/lib/ant.jar
>org.apache.tools.ant.gui.Main
>
>BUILD FAILED
>
>/home/sfitch/jakarta-ant/src/antidote/build.xml:116:
>java.io.IOException: java: cannot execute
Hmm - acouple of things come to mind.
Is java in PATH?
if you type the above into command line will it work?
If you change "-Djava.compiler=NONE" to "-Djava.compiler=" will it work ?
Cheers,
Pete
*------------------------------------------------------*
| Despite your efforts to be a romantic hero, you will |
| gradually evolve into a postmodern plot device. |
*------------------------------------------------------*