Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process.Start Help in Java

Is it possible to do the following C# Code in Java?

Process.Start("c:/test.exe", "filearg1,filearg2,filearg3");
like image 927
Alex Avatar asked Dec 10 '10 21:12

Alex


2 Answers

Yes, but you need to use Runtime and Process classes.

You can use something like this:

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("c:/test.exe filearg1,filearg2,filearg3");
like image 115
Pablo Santa Cruz Avatar answered Sep 21 '22 03:09

Pablo Santa Cruz


I recommend that you read "When Runtime.exec() won't" article.

like image 36
kgiannakakis Avatar answered Sep 21 '22 03:09

kgiannakakis