1
我在我的客戶端應用程序中動態編譯代碼。當我用Java Web Start啓動應用程序時,我得到一個異常。只有通過Java Web Start運行時纔會發生異常。如何在動態編譯代碼時訪問由Java Web Start加載的類?
//The exception
evolver.core.model.change.execution.ExecutionException: Compilation failed!
DynamicComparator.java:2: package evolver.core.model.i does not exist
import evolver.core.model.i.IDefaultObject;
^
DynamicComparator.java:9: cannot find symbol
symbol : class PropertyBag
location: class DynamicComparator
PropertyBag b2 = new PropertyBag(dob2);
^
以上的PropertyBag應當提供由JNLPClassloader作爲 它是由JWS
引起該問題看起來像這樣的代碼下載的文件的一個組成部分。
public static int compile(String javaFileName) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
PrintWriter w = new PrintWriter(os);
int res = com.sun.tools.javac.Main.compile(new String[]{"-d", "./", javaFileName}, w);
if (res != 0)
throw new ExecutionException("Compilation failed!" + "\n\n" + os.toString());
return res;
}
任何幫助將非常感激!