Execute system command : Runtime « Development Class « Java
- Java
- Development Class
- Runtime
Execute system command
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
String cmd = "cmd.exe /c start ";
// String file = "c:\\version.txt";
// String file = "http://www.google.com";
// String file = "c:\\";
// String file = "mailto:[email protected]";
String file = "mailto:";
Runtime.getRuntime().exec(cmd + file);
}
}
Related examples in the same category