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(); } } } |
Related Examples
- How do I read system property as an integer?
- How do I decode string to integer?
- How do I insert a string in the StringBuilder?
- How do I remove substring from StringBuilder?
- How do I reverse a string by word?
- How do I convert varargs to an array?
- How do I remove trailing white space from a string?
- How do I remove leading white space from a string?
- How do I create a method that accept varargs in Java?
- How do I know a class of an object?
|
|