Runtime.getRuntime() : Runtime « java.lang « Java by API






Runtime.getRuntime()

 
/*
 * Output:
 * 

 *   
 * 
 *  
 */
public class MainClass {
  public static void main(String args[]) {
  Runtime r = Runtime.getRuntime();
  Process p = null;
  String cmd[] = { "notepad", "/java/src/java/lang/Runtime.java" };
  try {
      p = r.exec(cmd);
  } catch (Exception e) {
      System.out.println("error executing " + cmd[0]);
  }
  }
}

           
         
  








Related examples in the same category

1.Runtime: availableProcessors()
2.Runtime: addShutdownHook(Thread hook)
3.Runtime: exec(String[] command)
4.Runtime: exec(String command) (2)
5.Runtime: freeMemory()
6.Runtime: gc()
7.Runtime: maxMemory()
8.Runtime: totalMemory()