You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Robert Mark Bram <re...@optusnet.com.au> on 2004/05/30 14:55:58 UTC

Open new command window for ANT task

Hi All!

I am trying to write an Ant task capable of opening a new command window..
(for Dos or *nux).. Then I will use this to help with Jini tasks..

My first step is finding Java code to do such an ugly task!

When I try the following test:
public class Command
{
    public static void main (String [] args) throws Exception
    {
       Runtime.getRuntime( ) .exec ( new String [] {"start", "cmd"});
    }  // end main method

}  // end Command class

I get:
F:\java\tests>javac Command.java && java Command
Exception in thread "main" java.io.IOException: CreateProcess: start cmd
error=2
         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:566)
         at java.lang.Runtime.exec(Runtime.java:491)
         at java.lang.Runtime.exec(Runtime.java:457)
         at Command.main(Command.java:5)

F:\java\tests>

Is there something that I am missing here?

Any help would be most appreciated!

Rob
:)



-- 
Robert Mark Bram
B.Comp.(Systems Development/Business Systems)
B.Net.Comp.(Hons)
Doctor of Philosophy Student

School of Network Computing
Faculty of Information Technology
Monash University
Peninsula Campus
McMahons Rd
Frankston, VIC 3199
AUSTRALIA

Phone:  61 3 9904 4394
Facsimile:  61 3 9904 4124
Email: robert.mark.bram@infotech.monash.edu.au


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