}
if (classArgs == null)
classArgs = new String[0];
Isolate newIsolate;
if (properties != null && properties.size() > 0) {
newIsolate = new Isolate(properties, mainClass, classArgs);
} else {
newIsolate = new Isolate(mainClass, classArgs);
}
try {
classPath.add(0, new File(".").toURI().toURL());
Field field = newIsolate.getClass().getDeclaredField("impl");
field.setAccessible(true);
VmIsolate vmi = (VmIsolate) field.get(newIsolate);
vmi.setClasspath(classPath.toArray(new URL[classPath.size()]));
} catch (Exception x) {
x.printStackTrace();
return;
}
try {
Link link = newIsolate.newStatusLink();
newIsolate.start();
//wait for exit
for (;;) {
LinkMessage msg = link.receive();
if (msg.containsStatus() && IsolateStatus.State.EXITED.equals(msg.extractStatus().getState()))
break;