Ruang penulis
← Kembali ke jurnal
Core API

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.lang; import java.io.IOException; public class RuntimeExec { public static void main(String[] args) { //String command = "/Applications/Safari.app/Contents/MacOS/Safari"; String command = "explorer.exe"; try { Process process = Runtime.getRuntime().exec(new String[]{command}); } catch (IOException e) { e.printStackTrace(); } } }

DWayan · 30 Apr 2006 · 1 menit baca

Artikel oleh Wayan · Sumber: Kode Java ↗

Terjemahan artikel ini belum tersedia. Isi asli ditampilkan.

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

package org.kodejava.lang;

import java.io.IOException;

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

        try {
            Process process = Runtime.getRuntime().exec(new String[]{command});
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
← Jelajahi catatan lainnya