How to open/run java program using cmd in another java program -


I want to compile Java program by creating a Java command through another Java program in CMD, then run it I How to do Is there a class that I can use?

For example, here is the CMD C: \ user \ user name \ document> Javak helloard. Java

How can I compile HelloWorld.java inside a Java program, then it Let's run.

Here is my initial source code that contains a directory and Java file.

  public class test {public static zero main (string [] args) {string directory = "c: \\ user \\ user name \" document "; String filename = "HelloWorld.java"; }}  

try it

  try {/ / Execute command string command = "cmd / c start cmd.exe"; Process child = Runtime.getRuntime (). Exec (command); // Get the output stream to write it out OutputStream Out = child.getOutputStream (); Out.write ("and execute Java class by mentioning the normal order;"); Out.flush (); Out.close (); } Hold (IOException e) {}  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -