❶ java怎么调用shell脚本
//用法:Runtime.getRuntime().exec("命令");Stringshpath="/test/test.sh";//程序路径Processprocess=null;Stringcommand1=“chmod777”+shpath;try{Runtime.getRuntime().exec(command1).waitFor();}catch(IOExceptione1){e1.printStackTrace();}catch(InterruptedExceptione){e.printStackTrace();}Stringvar="201102";/参数专Stringcommand2=“/bin/sh”+shpath+””属+var;Runtime.getRuntime().exec(command2).waitFor();