Scott,
What happens if you change the line:
<exec dir="c:\testit" executable="test"/>
to:
<exec dir="c:\testit" executable="test.exe"/>
Felice
-----Original Message-----
From: Scott Matthews [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 9:52 AM
To: [EMAIL PROTECTED]
Subject: "<exec>" dir question
I am on a Windows 98 box. I am having trouble executing an "EXE" file from
a directory other than the current directory I am in.
For Example: I am in a "C:\TestAnt" subdirectory where I have the
following "latest.xml" file (between lines with equal signs):
=======================================================
<project name="Latest Test" default="Latest Test">
<!-- latest.xml -->
<!-- dummy "jar" stub to be used later -->
<target name="jar">
</target>
<target name="Latest Test" depends="jar" description="testithere">
<echo message="Testit is executing now"/>
<exec dir="c:\testit" executable="test"/>
</target>
</project>
=======================================================
I want to execute a file named "test.exe" which is located in the
"c:\testit" subdirectory. When I run the following command:
ant -buildfile latest.xml -logfile logit.txt
I get many error message lines(In "logit.txt"):
===================================================================
Buildfile: latest.xml
jar:
Latest Test:
[echo] Testit is executing now
BUILD FAILED
C:\testant\latest.xml:11: Execute failed: java.io.IOException:
CreateProcess: test error=0
--- Nested Exception ---
java.io.IOException: CreateProcess: test error=0
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:66)
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.jav
a:509)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:329)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:228)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:162)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)
Total time: 1 second
===================================================================
I can get this "latest.xml" file to work if I either:
1. put Test.exe in the current subdirectory or
2. if I put "c:\testit" in the path.
My understanding is the above line in "latest.xml":
<exec dir="c:\testit" executable="test"/>
that "dir" is the directory where you are supposed to run the EXE from.
What am I doing wrong?
Thanks