How do I execute other applications from Java?

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

package org.kodejava.example.lang;


public class RuntimeExec {
    public static void main(String[] args) {
        //String command = "/Applications/";
        String command = "explorer.exe";

        try {
            Process process = Runtime.getRuntime().exec(command);
        } catch (IOException e) {

Wayan Saryada

Founder at Kode Java Org
I am a programmer, a runner, a recreational diver, currently live in the island of Bali, Indonesia. Mostly programming in Java, Spring Framework, Hibernate / JPA. If these posts help, you can support me, buy me a cup of coffee or tea. Thank you 🥳

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.