// process events
EventQueue eventQueue = vm.eventQueue();
// resume the vm
Process process = vm.process();
// Copy target's output and error to our output and error.
Thread outThread = new StreamRedirectThread("out reader", process.getInputStream());
Thread errThread = new StreamRedirectThread("error reader", process.getErrorStream());