1 public static void main(String[] args) { 2 Process pr; 3 try { 4 // 第二个参数是脚本的位置,后面的三个参数都是传递的参数(也就是脚本运行可能需要的参数) 5 String[] args1 = new String[] { "python", "G:\Software\eclipse\workspace\lego\src\test\java\com\lego\lego\ticket.py", "临汾", "西安", "2019-3-29"}; 6 pr = Runtime.getRuntime().exec(args1); 7 BufferedReader in = new BufferedReader(new InputStreamReader( 8 pr.getInputStream())); 9 in.close(); 10 pr.waitFor(); 11 System.out.println("end"); 12 } catch (IOException e) { 13 e.printStackTrace(); 14 } catch (InterruptedException e) { 15 e.printStackTrace(); 16 } 17 }