I want to create a Java program through which I can compile and run another program.
I usually know how to compile and run via cmd. Is there any idea to use cmd command in Java program?
-
Do you mean compile and run a program on cmd, which in itself will compile and run a second program? And if so, why?Andrew Martin– Andrew Martin2013-08-21 18:28:58 +00:00Commented Aug 21, 2013 at 18:28
-
andrew i'm creating a java project to compile compile and run other java programs.Arnold Parge– Arnold Parge2013-08-21 18:31:52 +00:00Commented Aug 21, 2013 at 18:31
Add a comment
|
1 Answer
Yes, there is. You use the ProcessBuilder class, or Runtime.exec. For more details, see the java API.