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


Java Program To Run Application

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

Similar Programs Chapter Last Updated
Java System.getProperties() Example System 20-04-2016
Java Classpath Using System Class System 20-04-2016
Java Specification Version Using System Class System 03-08-2016
Operating System Using System Class In Java System 06-04-2016

1