I am dynamically compiling code in my client application. When I start the application with Java Web Start I get an exception. The exception only occurs when it is run through 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);
^
The PropertyBag above should have been provided by the JNLPClassloader as it is part of one of the files that are downloaded by JWS
The code that causes the problem looks like this.
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;
}
Any help will be very appreciated!