shell腳本調(diào)用java代碼 怎樣在java代碼中調(diào)用執(zhí)行shell腳本?
怎樣在java代碼中調(diào)用執(zhí)行shell腳本?//用法:運(yùn)行時(shí).getRuntime(). Exec(“command”)string shpath=“/測(cè)試/測(cè)試.sh“//程序路徑process=n
怎樣在java代碼中調(diào)用執(zhí)行shell腳本?
//用法:運(yùn)行時(shí).getRuntime(). Exec(“command”)string shpath=“/測(cè)試/測(cè)試.sh“//程序路徑process=null string command1=”Chmod 777“shpath try{運(yùn)行時(shí).getRuntime().exec(command1).waitFor()}catch(IOException e1){e1.printStackTrace()}catch(interruptedeexception e){e.printStackTrace()}string var=“201102”/參數(shù)string command2=“/bin/sh”shpath“”變量運(yùn)行時(shí).getRuntime().exec(command2).waitFor()