java runtime.getRuntime.exec( cmd ) with long parameters

后端 未结 3 1451
生来不讨喜
生来不讨喜 2021-01-28 15:35

I\'m making a frontend for a command line app. It has a very long The command line is something simliar to this:

public String liveShellCommand(){

  String cmd         


        
3条回答
  •  抹茶落季
    2021-01-28 15:57

    Use ProcessBuilder and pass it a String[]

         String[] cmmm = {arg3,arg4,arg5, arg6,arg7 };
         ProcessBuilder pb = new ProcessBuilder(cmmm);
         pb.directory(new File(tDir));
         Process p = pb.start();
    

提交回复
热议问题