java代码执行linux命令 怎样在java代码中调用执行shell脚本?
怎样在java代码中调用执行shell脚本?//用法:运行时.getRuntime(). Exec(“command”)string shpath=“/测试/测试.sh“//程序路径process=n
怎样在java代码中调用执行shell脚本?
//用法:运行时.getRuntime(). Exec(“command”)string shpath=“/测试/测试.sh“//程序路径process=null string command1=”Chmod 777“shpath try{运行时.getRuntime().exec(command1).waitFor()}catch(IOException e1){e1.printStackTrace()}catch(interruptedeexception e){e.printStackTrace()}string var=“201102”/参数string command2=“/bin/sh”shpath“”变量运行时.getRuntime().exec(command2).waitFor()