Java: Can't execute external exe with arguments

前端 未结 3 616
Happy的楠姐
Happy的楠姐 2021-01-21 17:05

I’m trying to run an external program with arguments. The program can take different types of arguments, for instance avl tip.avl or avl < test.ops<

3条回答
  •  余生分开走
    2021-01-21 17:46

    Thank you both, the below works as expected.

    File pipe = new File("test_0.ops");
    ProcessBuilder pb = new ProcessBuilder("avl");
    pb.redirectInput(pipe);
    final Process p = pb.start();
    

提交回复
热议问题