1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
package test;
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader;
public class {
public static void main(String[] args) throws IOException, InterruptedException { System.out.println("-----------------"); String exe = "python3"; String command = "./dtcTest.py"; String num1 = "1"; String num2 = "2"; System.out.println("11111111111"); String[] cmdArr = new String[] {exe, command, num1, num2}; Process process;
process = Runtime.getRuntime().exec(cmdArr);
InputStream is = process.getInputStream(); String str;
InputStreamReader dat=new InputStreamReader(is); BufferedReader bin=new BufferedReader(dat); while((str=bin.readLine())!=null){ System.out.println(str); } process.waitFor(); } }
|
近期评论