Process process2 = Runtime.getRuntime().exec(new String[]{"javac","-g:vars","/Users/amol/Documents/Java/a.java"});
Process process3 = Runtime.getRuntime().exec(new String[]{"javap","-l","-c","/Users/amol/Documents/Java/a"});
我試着運行這段代碼,但我面臨一個奇怪的問題。它編譯正確(意味着第一行編譯程序),但第二行給出錯誤,說'a' not found
。但是,當我檢查給定的目錄a.class
文件被正確創建。我應該如何正確運行第二行?在運行時執行java命令
我運行此代碼,它工作! – Shahryar