public static void main(String[] args) throws IOException {
String s = null;
String command = "python <your_command>";
Process p = Runtime.getRuntime().exec(command);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
// read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
}
我不知道这是否对您有帮助,但您可以在java中以这种方式执行系统命令:
您可以在http://alvinalexander.com/java/edu/pj/pj010016中看到一个详细的示例
希望这对你有帮助:D
相关问题 更多 >
编程相关推荐