use of com.sun.jdi.VirtualMachineManager in project ceylon-compiler by ceylon.
the class TracerImpl method start.
public void start() throws Exception {
VirtualMachineManager vmm = com.sun.jdi.Bootstrap.virtualMachineManager();
LaunchingConnector conn = vmm.defaultConnector();
Map<String, Argument> defaultArguments = conn.defaultArguments();
defaultArguments.get("main").setValue(mainClass);
defaultArguments.get("options").setValue("-cp " + classPath);
System.out.println(defaultArguments);
vm = conn.launch(defaultArguments);
err = vm.process().getErrorStream();
out = vm.process().getInputStream();
eq = vm.eventQueue();
rm = vm.eventRequestManager();
outer: while (true) {
echo(err, System.err);
echo(out, System.out);
events = eq.remove();
for (Event event : events) {
if (event instanceof VMStartEvent) {
System.out.println(event);
break outer;
} else if (event instanceof VMDisconnectEvent || event instanceof VMDeathEvent) {
System.out.println(event);
vm = null;
rm = null;
eq = null;
break outer;
}
}
events.resume();
}
echo(err, System.err);
echo(out, System.out);
}
Aggregations