Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open new command window for ANT task

0 views
Skip to first unread message

Robert Mark Bram

unread,
May 30, 2004, 3:57:44 AM5/30/04
to
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
:)


0 new messages