本文链接https://blog.csdn.net/qq_37552993/article/details/80235010?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
package test;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
public class TestDatax {
public static void main(String[] args) {
try {
System.out.println("start");
String windowcmd = "cmd /c python2 datax.py F:\json.json";
//.exec("你的命令",null,new File("datax安装路径"));
Process pr = Runtime.getRuntime().exec(windowcmd,null,new File("D:\DataX\datax\bin"));
BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
pr.waitFor();
System.out.println("end");
} catch (Exception e) {
e.printStackTrace();
}
}
}