This package is a system to allow the invocation and control of a new Java virtual machine. The two JVMs can communicate by using RMI.

To simply invoke a new JVM with no communications links, use the class {@link edu.rice.cs.util.newjvm.ExecJVM}. The rest of this page explains how to use this framework to create a new JVM and set up bidirectional communications using RMI. This system runs a second JVM using the same classpath as the current JVM (by invoking {@link edu.rice.cs.util.newjvm.ExecJVM#runJVMPropagateClassPath}).

  1. Create a remote interface that the master JVM will support, extending {@link edu.rice.cs.util.newjvm.MasterRemote}. This interface must specify of the methods that the slave JVM can call on the master JVM. All methods in this interface must be declared to throw {@link java.rmi.RemoteException.}
  2. Create a remote interface that the slave JVM will support, extending {@link edu.rice.cs.util.newjvm.SlaveRemote}. This interface must specify of the methods that the master JVM can call on the slave JVM. All methods in this interface must be declared to throw {@link java.rmi.RemoteException.}
  3. Create the master JVM implementation, which must extend {@link edu.rice.cs.util.newjvm.AbstractMasterJVM} and implement YourMasterInterface. Note that the super() call must pass to AbstractMasterJVM the fully-qualified class name of the slave JVM implementation.
  4. Create the slave JVM implementation, which must implement YourSlaveInterface. Don't forget to implement {@link edu.rice.cs.util.newjvm.SlaveRemote#quit()}, which is called when the main JVM requests the slave to quit, and {@link edu.rice.cs.util.newjvm.SlaveRemote#start(edu.rice.cs.util.newjvm.MasterRemote)}, which is called when the slave JVM is started.

Now you can create an instance of your master JVM class and use its {@link edu.rice.cs.util.newjvm.AbstractMasterJVM#invokeSlave()} method to start the slave JVM.