How do I execute other applications from Java?

Category: java.lang, viewed: 1787 time(s).

The following program allows you to run / execute other application from Java using the Runtime.exec(...) method.

 
package org.kodejava.sample.java.lang;
 
import java.io.IOException;
 
public class RuntimeExec
{
    public static void main(String[] args)
    {
        String command = "explorer.exe";
 
        try
        {
            Process process = Runtime.getRuntime().exec(command);
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
 
 
Bookmark this example!  

Most Viewed Examples

Google

100 Top & Latest


eXTReMe Tracker
visitor stats