title: How to run java program using another java program?
body: <p>I am using below code,</p>
  
  <pre><code>Runtime runTime = Runtime.getRuntime();
  Process p = runTime.exec("javac C:\\testDemo\\Demo.java");
  p.waitFor();
  
  Process p2= Runtime.getRuntime().exec("java Demo.class");
  p2.waitFor();
  </code></pre>
  
  <p>it is creating a .class file, but its unable to run this program. do i need to do any change in <code>Runtime.getRuntime().exec("java Demo.class");</code> method?</p>