Class AbstractVMRunner

java.lang.Object
org.eclipse.jdt.launching.AbstractVMRunner
All Implemented Interfaces:
IVMRunner

public abstract class AbstractVMRunner extends Object implements IVMRunner
Abstract implementation of a VM runner.

Clients implementing VM runners should subclass this class.

Since:
2.0
See Also:
  • Constructor Details

    • AbstractVMRunner

      public AbstractVMRunner()
  • Method Details

    • abort

      protected void abort(String message, Throwable exception, int code) throws org.eclipse.core.runtime.CoreException
      Throws a core exception with an error status object built from the given message, lower level exception, and error code.
      Parameters:
      message - the status message
      exception - lower level exception associated with the error, or null if none
      code - error code
      Throws:
      org.eclipse.core.runtime.CoreException - The exception encapsulating the reason for the abort
    • getPluginIdentifier

      protected abstract String getPluginIdentifier()
      Returns the identifier of the plug-in this VM runner originated from.
      Returns:
      plug-in identifier
    • exec

      protected Process exec(String[] cmdLine, File workingDirectory) throws org.eclipse.core.runtime.CoreException
      Executes the given command line using the given working directory
      Parameters:
      cmdLine - the command line
      workingDirectory - the working directory
      Returns:
      the Process
      Throws:
      org.eclipse.core.runtime.CoreException - if the execution fails
      See Also:
      • DebugPlugin.exec(String[], File)
    • exec

      protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws org.eclipse.core.runtime.CoreException
      Executes the given command line using the given working directory and environment
      Parameters:
      cmdLine - the command line
      workingDirectory - the working directory
      envp - the environment
      Returns:
      the Process
      Throws:
      org.eclipse.core.runtime.CoreException - is the execution fails
      Since:
      3.0
      See Also:
      • DebugPlugin.exec(String[], File, String[])
    • exec

      protected Process exec(String[] cmdLine, File workingDirectory, String[] envp, boolean mergeOutput) throws org.eclipse.core.runtime.CoreException
      Executes the given command line using the given working directory and environment
      Parameters:
      cmdLine - the command line
      workingDirectory - the working directory
      envp - the environment
      mergeOutput - if true the error stream will be merged with standard output stream and both can be read through the same output stream
      Returns:
      the Process
      Throws:
      org.eclipse.core.runtime.CoreException - is the execution fails
      Since:
      3.15
      See Also:
      • DebugPlugin.exec(String[], File, String[])
    • quoteWindowsArgs

      protected static String[] quoteWindowsArgs(String[] cmdLine)
      Since:
      3.11
    • getCmdLineAsString

      protected String getCmdLineAsString(String[] cmdLine)
      Returns the given array of strings as a single space-delimited string.
      Parameters:
      cmdLine - array of strings
      Returns:
      a single space-delimited string
    • getDefaultProcessMap

      protected Map<String,String> getDefaultProcessMap()
      Returns the default process attribute map for Java processes.
      Returns:
      default process attribute map for Java processes
    • newProcess

      protected org.eclipse.debug.core.model.IProcess newProcess(org.eclipse.debug.core.ILaunch launch, Process p, String label, Map<String,String> attributes) throws org.eclipse.core.runtime.CoreException
      Returns a new process aborting if the process could not be created.
      Parameters:
      launch - the launch the process is contained in
      p - the system process to wrap
      label - the label assigned to the process
      attributes - values for the attribute map
      Returns:
      the new process
      Throws:
      org.eclipse.core.runtime.CoreException - problems occurred creating the process
      Since:
      3.0
    • combineVmArgs

      protected String[] combineVmArgs(VMRunnerConfiguration configuration, IVMInstall vmInstall)
      Combines and returns VM arguments specified by the runner configuration, with those specified by the VM install, if any.
      Parameters:
      configuration - runner configuration
      vmInstall - VM install
      Returns:
      combined VM arguments specified by the runner configuration and VM install
      Since:
      3.0
    • isModular

      protected boolean isModular(VMRunnerConfiguration config, IVMInstall vmInstall)
      Examines the project and install for presence of module and execution support.
      Parameters:
      config - runner configuration
      vmInstall - VM install
      Returns:
      true if project is a module and uses JRE version 9 or more, or false otherwise
      Since:
      3.10