Java Program To Run Application
Chapter:
System
Last Updated:
24-06-2017 06:38:04 UTC
Program:
/* ............... START ............... */
public class JavaRunApplication {
public static void main(String[] args) {
Runtime app = Runtime.getRuntime();
try {
// open notepad
app.exec("notepad");
// open calculator
app.exec("calc");
} catch (Exception Ex) {
System.out.println("Error: " + Ex.toString());
}
}
}
/* ............... END ............... */
Output
Notes:
-
This program will open (run) applications (Notepad, Calculator) using Java program. To open/run application we are using instance of Runtime.getRuntime() and method exec().
Tags
Java Program To Run Application, Java, Swing