shell腳本調(diào)用java代碼 怎樣在java代碼中調(diào)用執(zhí)行shell腳本?
怎樣在java代碼中調(diào)用執(zhí)行shell腳本?//用法:運行時.getRuntime(). Exec(“command”)string shpath=“/測試/測試.sh“//程序路徑process=n
怎樣在java代碼中調(diào)用執(zhí)行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”/參數(shù)string command2=“/bin/sh”shpath“”變量運行時.getRuntime().exec(command2).waitFor()