Q:

Java program to run an application - Run Exe using Java program

0

Java program to run an application - Run Exe using Java program

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Run an application using Java program

//Java program to run an application.

import java.util.*;

class OpenNotepad {
  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());
    }
  }
}

Output:

    
    Notepad and Calculator will be opened.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Core Java Example programs for Beginners and Professionals

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Java program to get list of files, directories fro... >>
<< Java program to extract digits/ numbers from the s...