Open new command window for ANT task

R

Robert Mark Bram

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
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top