Process Builder

M

Meidan

Hi,

I added the following command to my code:

ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1",
"myArg2");

and got this error message:
"The constructor ProcessBuilder(String, String, String) is undefined"

Does anyone knows what's the problem?

Thanks.
 
A

Andrew Thompson

Meidan said:
I added the following command to my code:

ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1",
"myArg2");

and got this error message:
"The constructor ProcessBuilder(String, String, String) is undefined"

Perhaps what Sun *meant* to say at the top of their 1.5
JavaDocs for ProcessBuilder was..

String[] commands = {"myCommand", "myArg1", "myArg2"};
ProcessBuilder pb = new ProcessBuilder(commands);

...note the array of commands, which matches this constructor.
<http://java.sun.com/j2se/1.5.0/docs...lder.html#ProcessBuilder(java.lang.String...)>

HTH
 
R

Roedy Green

ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1",
"myArg2");

and got this error message:
"The constructor ProcessBuilder(String, String, String) is undefined"

I gather you are using a pre 1.5 java. ProcessBuilder( String...) was
only invented with 1.5.

prior to that you would have had to use new Strin[] { .... };

see http://mindprod.com/jdk.html
to get 1.5. It is about a year old now.
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top