Launch a Unix script with Java : Runtime « Development Class « Java
- Java
- Development Class
- Runtime
Launch a Unix script with Java
public class Main {
public static void main(String[] argv) throws Exception {
String[] cmd = { "/bin/sh", "-c", "ls > hello" };
Runtime.getRuntime().exec(cmd);
}
}
Related examples in the same category