Runtime: exec(String command) (2) : Runtime « java.lang « Java by API






Runtime: exec(String command) (2)

 
/*
 * Output: 
 */

public class MainClass {
  public static void main(String args[]) {
    Runtime r = Runtime.getRuntime();
    Process p = null;

    try {
      p = r.exec("notepad");
    } catch (Exception e) {
      System.out.println("Error executing notepad.");
    }
  }
}

           
         
  








Related examples in the same category

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