Java
Execute external command which does not need standard input/output
in Java
Execute external command which does not need standard input/output. In this sample, execute touch command on Linux to create a file "panda.txt", by Java.
Command.java
public class Command { public static void main(String[] args) { try { Process process = Runtime.getRuntime().exec("touch panda.txt"); } catch (java.io.IOException e) { e.printStackTrace(); } } }
Result
$ ls Command.java $ javac Command.java $ java Command $ ls Command.java panda.txt