动态编译代码时,如何访问JavaWebStart加载的类?

动态编译代码时,如何访问JavaWebStart加载的类?,java,jnlp,java-web-start,dynamic-compilation,Java,Jnlp,Java Web Start,Dynamic Compilation,我正在客户端应用程序中动态编译代码。当我用JavaWebStart启动应用程序时,我得到一个异常。该异常仅在通过JavaWebStart运行时发生 //The exception evolver.core.model.change.execution.ExecutionException: Compilation failed! DynamicComparator.java:2: package evolver.core.model.i does not exist import evolve

我正在客户端应用程序中动态编译代码。当我用JavaWebStart启动应用程序时,我得到一个异常。该异常仅在通过JavaWebStart运行时发生

//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;
}

任何帮助都将不胜感激

目前,您必须在服务器上编译代码。服务器不应该提供任何可能允许跨站点攻击的代码,因此要非常小心。然后,客户端可以使用URLClassLoader.newInstance来加载它。

由于当前的情况,您必须在服务器上编译代码。服务器不应该提供任何可能允许跨站点攻击的代码,因此要非常小心。然后,客户端可以使用URLClassLoader.newInstance来加载它