Class JVM

java.lang.Object
org.apidesign.jvm.channel.JVM

public final class JVM extends Object
Represents another JVM inside of the current process. Provides a factory method to boot a HotSpot JVM from inside of a GraalVM native image application. Allows one to easily execute a main method in the other JVM via executeMain(String, String...). See Channel for more intricate communication between the JVMs.
See Also:
  • Method Details

    • create

      public static JVM create(File path, String... options)
      Create new JVM. Either HotSpot JVM or natively compiled JVM. Use executeMain(String, String...) to launch a main method inside of the JVM. Use Channel.create(JVM, Class) to establish a channel to send more intricate messages to the JVM.
      Parameters:
      path - path where the JDK is installed - either path to the HotSpot JVM directory or direct path to the dynamic library that contains the JNI_CreateJavaVM entry point
      options - parameters to pass to the JVM
      Returns:
      new instance of the JVM
    • executeMain

      public final void executeMain(String classNameWithSlashes, String... args)
      Executes main method of provided class
      Parameters:
      classNameWithSlashes - class (with `/` as separators) to search main method in
      args - arguments to pass to the main method