Class JavaRuntime
"org.eclipse.jdt.launching.vmType"
extension point.
As well, this class provides VM install change notification,
and computes class paths and source lookup paths for launch
configurations.
This class provides static methods only.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Deprecated.static final String
Attribute key for a classpath attribute referencing a list of shared libraries that should appear on the-Djava.library.path
system property.static final int
Default launch/connect timeout (milliseconds).static final int
A status code indicating that a JRE could not be resolved for a project.static final String
Simple identifier constant (value"executionEnvironments"
) for the execution environments extension point.static final String
Simple identifier constant (value"libraryLocationResolvers"
) for the Library Resolvers extension pointstatic final String
Simple identifier constant (value"runtimeClasspathEntryResolvers"
) for the runtime classpath entry resolvers extension point.static final String
Simple identifier constant (value"classpathProviders"
) for the runtime classpath providers extension point.static final String
Simple identifier constant (value"vmInstalls"
) for the VM installs extension point.static final String
Unique identifier constant (value"org.eclipse.jdt.launching"
) for the Java launching plug-in.static final String
Marker type identifier for JRE compiler compliance problems.static final String
Classpath container used for a project's JRE (value"org.eclipse.jdt.launching.JRE_CONTAINER"
).static final String
Marker type identifier for JRE container problems.static final String
Classpath variable name used for the default JRE's library (value"JRE_LIB"
).static final String
Classpath variable name used for the default JRE's library source (value"JRE_SRC"
).static final String
Classpath variable name used for the default JRE's library source root (value"JRE_SRCROOT"
).static final String
Preference key for the problem severity when an compiler compliance that is set does not match the used JRE.static final String
Preference key for launch/connect timeout.static final String
Boolean preference controlling whether only exported entries should even be included when the runtime classpath is computedstatic final String
Preference key for the problem severity when an execution environment is bound to a project's build path for which there is no strictly compatible JRE available in the workspace.static final String
Preference key for the String of XML that defines all installed VMs. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addContainerResolver
(IRuntimeClasspathEntryResolver resolver, String containerIdentifier) Registers the given resolver for the specified container.static void
addVariableResolver
(IRuntimeClasspathEntryResolver resolver, String variableName) Registers the given resolver for the specified variable.static void
Adds the given listener to the list of registered VM install changed listeners.static int
compareJavaVersions
(IVMInstall vm, String ver) Compares the version of vm and a version of the Java platform.static String[]
computeDefaultRuntimeClassPath
(IJavaProject jproject) Computes the default application classpath entries for the given project.static String[]
computeJavaLibraryPath
(IJavaProject project, boolean requiredProjects) Returns a collection of paths that should be appended to the given project'sjava.library.path
system property when launched.static IRuntimeClasspathEntry
computeJREEntry
(org.eclipse.debug.core.ILaunchConfiguration configuration) Returns a runtime classpath entry identifying the JRE to use when launching the specified configuration ornull
if none is specified.static IRuntimeClasspathEntry
computeJREEntry
(IJavaProject project) Returns a runtime classpath entry identifying the JRE referenced by the specified project, ornull
if none.static IRuntimeClasspathEntry
computeModularJREEntry
(IJavaProject project) Returns a runtime classpath or modulepath entry identifying the JRE referenced by the specified project, ornull
if none.static IRuntimeClasspathEntry[]
computeUnresolvedRuntimeClasspath
(org.eclipse.debug.core.ILaunchConfiguration configuration) Computes and returns the unresolved class path for the given launch configuration.static IRuntimeClasspathEntry[]
Computes and returns the default unresolved runtime classpath for the given project.static IRuntimeClasspathEntry[]
computeUnresolvedRuntimeClasspath
(IJavaProject project, boolean excludeTestCode) Computes and returns the default unresolved runtime classpath for the given project.static IRuntimeClasspathEntry[]
Computes and returns the default unresolved runtime classpath and modulepath for the given project.static IRuntimeClasspathEntry[]
computeUnresolvedRuntimeDependencies
(IJavaProject project, boolean excludeTestCode) Computes and returns the default unresolved runtime classpath and modulepath for the given project.static IRuntimeClasspathEntry[]
computeUnresolvedSourceLookupPath
(org.eclipse.debug.core.ILaunchConfiguration configuration) Computes and returns the unresolved source lookup path for the given launch configuration.static IVMInstall
computeVMInstall
(org.eclipse.debug.core.ILaunchConfiguration configuration) Returns the VM install for the given launch configuration.static VMStandin
createVMFromDefinitionFile
(File eeFile, String name, String id) Creates a new VM based on the attributes specified in the given execution environment description file.static void
Notifies all VM install changed listeners of the VM additionstatic void
fireVMChanged
(PropertyChangeEvent event) Notifies all VM install changed listeners of the given property change.static void
Notifies all VM install changed listeners of the VM removalstatic IRuntimeClasspathProvider
getClasspathProvider
(org.eclipse.debug.core.ILaunchConfiguration configuration) Returns the classpath provider for the given launch configuration.static String
Returns a String that uniquely identifies the specified VM across all VM types.static IClasspathEntry
Creates and returns a classpath entry describing the default JRE container entry.static IVMConnector
Return the default VM connector.static IVMInstall
Return the default VM set withsetDefaultVM()
.static String
getExecutionEnvironmentId
(org.eclipse.core.runtime.IPath jreContainerPath) Returns the execution environment identifier in the following JRE classpath container path, ornull
if none.Returns the execution environments manager.static IJavaProject
getJavaProject
(org.eclipse.debug.core.ILaunchConfiguration configuration) Return theIJavaProject
referenced in the specified configuration ornull
if none.static IClasspathEntry
Creates and returns a classpath entry describing the JRE_LIB classpath variable.static LibraryLocation[]
Evaluates library locations for a IVMInstall.static String[]
getLibraryPaths
(IClasspathAttribute attribute) Returns an array of strings referencing shared libraries that should appear on the-Djava.library.path
system property at runtime for an associatedIClasspathEntry
, ornull
if the given attribute is not aCLASSPATH_ATTR_LIBRARY_PATH_ENTRY
.static String
getModuleCLIOptions
(org.eclipse.debug.core.ILaunchConfiguration configuration) Returns the module-related command line options for the configuration that are needed at runtime as equivalents of those options specified byIClasspathAttribute
s of the following names:IClasspathAttribute.ADD_EXPORTS
IClasspathAttribute.ADD_READS
IClasspathAttribute.LIMIT_MODULES
IClasspathAttribute.PATCH_MODULE
is not handled here, but inAbstractJavaLaunchConfigurationDelegate.getModuleCLIOptions(ILaunchConfiguration)
, which then collates all options referring to the same module.static org.eclipse.core.runtime.Preferences
Returns the preference store for the launching plug-in.static String
getProjectOutputDirectory
(org.eclipse.debug.core.ILaunchConfiguration config) Return the String representation of the default output directory of the launch config's project ornull
if there is no configuration, no project or some sort of problem.getProvidedVMPackages
(IVMInstall vm, String release) Returns the names of all packages publicly exported by the givenvmInstall
, optionally restricted to the given release version.static org.eclipse.debug.core.sourcelookup.ISourceContainer[]
getSourceContainers
(IRuntimeClasspathEntry[] entries) Returns a collection of source containers corresponding to the given resolved runtime classpath entries.static IRuntimeClasspathProvider
getSourceLookupPathProvider
(org.eclipse.debug.core.ILaunchConfiguration configuration) Returns the source lookup path provider for the given launch configuration.static IVMConnector
getVMConnector
(String id) Returns the VM connector defined with the specified identifier, ornull
if none.static IVMConnector[]
Returns all VM connector extensions.static IVMInstall
getVMFromCompositeId
(String idString) Return the VM corresponding to the specified composite Id.static IVMInstall
getVMInstall
(org.eclipse.core.runtime.IPath jreContainerPath) Returns the JRE referenced by the specified JRE classpath container path ornull
if none.static IVMInstall
getVMInstall
(IJavaProject project) Returns the VM assigned to build the given Java project.static String
getVMInstallName
(org.eclipse.core.runtime.IPath jreContainerPath) Returns the name of the VM install referenced by the given JRE classpath container path, ornull
if none.static IVMInstallType
Returns the VM install type with the given unique id.static String
getVMInstallTypeId
(org.eclipse.core.runtime.IPath jreContainerPath) Returns the identifier of the VM install type referenced by the given JRE classpath container path, ornull
if none.static IVMInstallType[]
Returns the list of registered VM types.static boolean
Returns whether the VM install with the specified id was contributed via the vmInstalls extension point.static boolean
isModularConfiguration
(org.eclipse.debug.core.ILaunchConfiguration configuration) Checks if configuration JRE is greater than 8.static boolean
Checks if vm install is modular( version greater than 8).static boolean
isModularProject
(IJavaProject proj) Checks if project entry is modularstatic boolean
isModule
(IClasspathEntry entry, IJavaProject proj) Checks if classpath entry is modular and project is modular .static boolean
Returns whether the given runtime classpath entry refers to a VM install.static IRuntimeClasspathEntry
newArchiveRuntimeClasspathEntry
(org.eclipse.core.resources.IResource resource) Returns a new runtime classpath entry for the given archive.static IRuntimeClasspathEntry
newArchiveRuntimeClasspathEntry
(org.eclipse.core.runtime.IPath path) Returns a new runtime classpath entry for the given archive (possibly external).static IRuntimeClasspathEntry
newArchiveRuntimeClasspathEntry
(org.eclipse.core.runtime.IPath path, int classpathProperty) Returns a new runtime classpath entry for the given archive(possibly external).static IRuntimeClasspathEntry
newArchiveRuntimeClasspathEntry
(org.eclipse.core.runtime.IPath path, int classpathProperty, IJavaProject javaProject) Returns a new runtime classpath entry for the given archive(possibly external).static IRuntimeClasspathEntry
newArchiveRuntimeClasspathEntry
(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported) Returns a new runtime classpath entry for the given archive (possibly external).static org.eclipse.core.runtime.IPath
Returns a path for the JRE classpath container identifying the default VM install.static IRuntimeClasspathEntry
Returns a new runtime classpath entry containing the default classpath for the specified Java project.static org.eclipse.core.runtime.IPath
newJREContainerPath
(String typeId, String name) Returns a path for the JRE classpath container identifying the specified VM install by type and name.static org.eclipse.core.runtime.IPath
newJREContainerPath
(IExecutionEnvironment environment) Returns a path for the JRE classpath container identifying the specified execution environment.static org.eclipse.core.runtime.IPath
Returns a path for the JRE classpath container identifying the specified VM install by type and name.static IClasspathAttribute
newLibraryPathsAttribute
(String[] paths) Creates a new classpath attribute referencing a list of shared libraries that should appear on the-Djava.library.path
system property at runtime for an associatedIClasspathEntry
.static IRuntimeClasspathEntry
Returns a new runtime classpath entry for the given project.static IRuntimeClasspathEntry
newProjectRuntimeClasspathEntry
(IJavaProject project, int classpathProperty) Returns a new runtime classpath entry for the given project.static IRuntimeClasspathEntry
newRuntimeClasspathEntry
(String memento) Returns a runtime classpath entry constructed from the given memento.static IRuntimeClasspathEntry
newRuntimeContainerClasspathEntry
(org.eclipse.core.runtime.IPath path, int classpathProperty) Returns a runtime classpath entry for the given container path with the given classpath property.static IRuntimeClasspathEntry
newRuntimeContainerClasspathEntry
(org.eclipse.core.runtime.IPath path, int classpathProperty, IJavaProject project) Returns a runtime classpath entry for the given container path with the given classpath property to be resolved in the context of the given Java project.static IRuntimeClasspathEntry
newStringVariableClasspathEntry
(String expression) Returns a new runtime classpath entry for the given expression that may contain string substitution variable references.static IRuntimeClasspathEntry
newVariableRuntimeClasspathEntry
(org.eclipse.core.runtime.IPath path) Returns a new runtime classpath entry for the classpath variable with the given path.static void
Removes the given listener from the list of registered VM install changed listeners.static IRuntimeClasspathEntry[]
resolveRuntimeClasspath
(IRuntimeClasspathEntry[] entries, org.eclipse.debug.core.ILaunchConfiguration configuration) Resolves the given classpath, returning the resolved classpath in the context of the given launch configuration.static IRuntimeClasspathEntry[]
resolveRuntimeClasspathEntry
(IRuntimeClasspathEntry entry, org.eclipse.debug.core.ILaunchConfiguration configuration) Returns resolved entries for the given entry in the context of the given launch configuration.static IRuntimeClasspathEntry[]
resolveRuntimeClasspathEntry
(IRuntimeClasspathEntry entry, IJavaProject project) Returns resolved entries for the given entry in the context of the given Java project.static IRuntimeClasspathEntry[]
resolveRuntimeClasspathEntry
(IRuntimeClasspathEntry entry, IJavaProject project, boolean excludeTestCode) Returns resolved entries for the given entry in the context of the given Java project.static IRuntimeClasspathEntry[]
resolveSourceLookupPath
(IRuntimeClasspathEntry[] entries, org.eclipse.debug.core.ILaunchConfiguration configuration) Resolves the given source lookup path, returning the resolved source lookup path in the context of the given launch configuration.static void
Saves the preferences for the launching plug-in.static void
Saves the VM configuration information to the preferences.static void
setDefaultVMConnector
(IVMConnector connector, org.eclipse.core.runtime.IProgressMonitor monitor) Sets a VM connector as the system-wide default VM.static void
setDefaultVMInstall
(IVMInstall vm, org.eclipse.core.runtime.IProgressMonitor monitor) Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change.static void
setDefaultVMInstall
(IVMInstall vm, org.eclipse.core.runtime.IProgressMonitor monitor, boolean savePreference) Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change.
-
Field Details
-
JRELIB_VARIABLE
Classpath variable name used for the default JRE's library (value"JRE_LIB"
).- See Also:
-
JRESRC_VARIABLE
Classpath variable name used for the default JRE's library source (value"JRE_SRC"
).- See Also:
-
JRESRCROOT_VARIABLE
Classpath variable name used for the default JRE's library source root (value"JRE_SRCROOT"
).- See Also:
-
EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS
Simple identifier constant (value"runtimeClasspathEntryResolvers"
) for the runtime classpath entry resolvers extension point.- Since:
- 2.0
- See Also:
-
EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS
Simple identifier constant (value"classpathProviders"
) for the runtime classpath providers extension point.- Since:
- 2.0
- See Also:
-
EXTENSION_POINT_EXECUTION_ENVIRONMENTS
Simple identifier constant (value"executionEnvironments"
) for the execution environments extension point.- Since:
- 3.2
- See Also:
-
EXTENSION_POINT_VM_INSTALLS
Simple identifier constant (value"vmInstalls"
) for the VM installs extension point.- Since:
- 3.2
- See Also:
-
EXTENSION_POINT_LIBRARY_LOCATION_RESOLVERS
Simple identifier constant (value"libraryLocationResolvers"
) for the Library Resolvers extension point- Since:
- 3.7
- See Also:
-
JRE_CONTAINER
Classpath container used for a project's JRE (value"org.eclipse.jdt.launching.JRE_CONTAINER"
). A container is resolved in the context of a specific Java project, to one or more system libraries contained in a JRE. The container can have zero or two path segments following the container name. When no segments follow the container name, the workspace default JRE is used to build a project. Otherwise the segments identify a specific JRE used to build a project:- VM Install Type Identifier - identifies the type of JRE used to build the project. For example, the standard VM.
- VM Install Name - a user defined name that identifies that a specific VM
of the above kind. For example,
IBM 1.3.1
. This information is shared in a projects classpath file, so teams must agree on JRE naming conventions.
Since 3.2, the path may also identify an execution environment as follows:
- Execution environment extension point name
(value
executionEnvironments
) - Identifier of a contributed execution environment
- Since:
- 2.0
-
JRE_CONTAINER_MARKER
Marker type identifier for JRE container problems.- Since:
- 3.6
-
JRE_COMPILER_COMPLIANCE_MARKER
Marker type identifier for JRE compiler compliance problems.- Since:
- 3.11
-
ERR_UNABLE_TO_RESOLVE_JRE
public static final int ERR_UNABLE_TO_RESOLVE_JREA status code indicating that a JRE could not be resolved for a project. When a JRE cannot be resolved for a project by this plug-in's container initializer, an exception is thrown with this status code. A status handler may be registered for this status code. Thesource
object provided to the status handler is the Java project for which the path could not be resolved. The status handler must return anIVMInstall
ornull
. The container resolver will re-set the project's classpath if required.- Since:
- 2.0
- See Also:
-
PREF_CONNECT_TIMEOUT
Preference key for launch/connect timeout. VM Runners should honor this timeout value when attempting to launch and connect to a debuggable VM. The value is an int, indicating a number of milliseconds.- Since:
- 2.0
-
PREF_VM_XML
Preference key for the String of XML that defines all installed VMs.- Since:
- 2.1
-
PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE
Preference key for the problem severity when an execution environment is bound to a project's build path for which there is no strictly compatible JRE available in the workspace. Value is one ofJavaCore.ERROR
,JavaCore.WARNING
,JavaCore.INFO
, orJavaCore.IGNORE
- Since:
- 3.5
-
PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE
Preference key for the problem severity when an compiler compliance that is set does not match the used JRE. Value is one ofJavaCore.ERROR
,JavaCore.WARNING
,JavaCore.INFO
, orJavaCore.IGNORE
This preference will not be applicable if the JRE used is 9 or above and
JavaCore.COMPILER_RELEASE
option is enabled.- Since:
- 3.10
-
ID_PLUGIN
Unique identifier constant (value"org.eclipse.jdt.launching"
) for the Java launching plug-in. This preference will not be applicable if the JRE used is 9 or above andJavaCore.COMPILER_RELEASE
option is enabled.- Since:
- 3.5
- See Also:
-
DEF_CONNECT_TIMEOUT
public static final int DEF_CONNECT_TIMEOUTDefault launch/connect timeout (milliseconds).- Since:
- 2.0
- See Also:
-
ATTR_CMDLINE
Deprecated.- useIProcess.ATTR_CMDLINE
Attribute key for a process property. The classorg.eclipse.debug.core.model.IProcess
allows attaching String properties to processes. The value of this attribute is the command line a process was launched with. Implementers ofIVMRunner
should use this attribute key to attach the command lines to the processes they create. -
PREF_ONLY_INCLUDE_EXPORTED_CLASSPATH_ENTRIES
Boolean preference controlling whether only exported entries should even be included when the runtime classpath is computed- Since:
- 3.7
- See Also:
-
CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
Attribute key for a classpath attribute referencing a list of shared libraries that should appear on the-Djava.library.path
system property.The factory methods
newLibraryPathsAttribute(String[])
andgetLibraryPaths(IClasspathAttribute)
should be used to encode and decode the attribute value.Each string is used to create an
IPath
using the constructorPath(String)
, and may containIStringVariable
's. Variable substitution is performed on the string prior to constructing a path from the string. If the resultingIPath
is a relative path, it is interpreted as relative to the workspace location. If the path is absolute, it is interpreted as an absolute path in the local file system.- Since:
- 3.1
- See Also:
-
-
Method Details
-
getVMInstall
public static IVMInstall getVMInstall(IJavaProject project) throws org.eclipse.core.runtime.CoreException Returns the VM assigned to build the given Java project. The project must exist. The VM assigned to a project is determined from its build path.- Parameters:
project
- the project to retrieve the VM from- Returns:
- the VM instance that is assigned to build the given Java project
Returns
null
if no VM is referenced on the project's build path. - Throws:
org.eclipse.core.runtime.CoreException
- if unable to determine the project's VM install
-
getVMInstallType
Returns the VM install type with the given unique id.- Parameters:
id
- the VM install type unique id- Returns:
- The VM install type for the given id, or
null
if no VM install type with the given id is registered.
-
setDefaultVMInstall
public static void setDefaultVMInstall(IVMInstall vm, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change.- Parameters:
vm
- The VM to make the default. May benull
to clear the default.monitor
- progress monitor ornull
- Throws:
org.eclipse.core.runtime.CoreException
- if trying to set the default VM install encounters problems
-
setDefaultVMInstall
public static void setDefaultVMInstall(IVMInstall vm, org.eclipse.core.runtime.IProgressMonitor monitor, boolean savePreference) throws org.eclipse.core.runtime.CoreException Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change.- Parameters:
vm
- The VM to make the default. May benull
to clear the default.monitor
- progress monitor ornull
savePreference
- Iftrue
, update workbench preferences to reflect the new default VM.- Throws:
org.eclipse.core.runtime.CoreException
- if trying to set the default VM install encounters problems- Since:
- 2.1
-
setDefaultVMConnector
public static void setDefaultVMConnector(IVMConnector connector, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Sets a VM connector as the system-wide default VM. This setting is persisted when saveVMConfiguration is called.- Parameters:
connector
- The connector to make the default. May benull
to clear the default.monitor
- The progress monitor to use- Throws:
org.eclipse.core.runtime.CoreException
- Thrown if saving the new default setting fails- Since:
- 2.0
-
getDefaultVMInstall
Return the default VM set withsetDefaultVM()
.- Returns:
- Returns the default VM. May return
null
when no default VM was set or when the default VM has been disposed.
-
getDefaultVMConnector
Return the default VM connector.- Returns:
- Returns the default VM connector.
- Since:
- 2.0
-
getVMInstallTypes
Returns the list of registered VM types. VM types are registered via"org.eclipse.jdt.launching.vmTypes"
extension point. Returns an empty list if there are no registered VM types.- Returns:
- the list of registered VM types
-
getCompositeIdFromVM
Returns a String that uniquely identifies the specified VM across all VM types.- Parameters:
vm
- the instance of IVMInstallType to be identified- Returns:
- the unique identifier for the specified VM
- Since:
- 2.1
-
getVMFromCompositeId
Return the VM corresponding to the specified composite Id. The id uniquely identifies a VM across all VM types.- Parameters:
idString
- the composite id that specifies an instance of IVMInstall- Returns:
- the VM corresponding to the specified composite Id.
- Since:
- 2.1
-
newStringVariableClasspathEntry
Returns a new runtime classpath entry for the given expression that may contain string substitution variable references. The resulting expression refers to an archive (jar or directory) containing class files.- Parameters:
expression
- an expression that resolves to the location of an archive- Returns:
- runtime classpath entry
- Since:
- 3.0
-
newDefaultProjectClasspathEntry
Returns a new runtime classpath entry containing the default classpath for the specified Java project.- Parameters:
project
- Java project- Returns:
- runtime classpath entry
- Since:
- 3.0
-
newProjectRuntimeClasspathEntry
Returns a new runtime classpath entry for the given project.- Parameters:
project
- Java project- Returns:
- runtime classpath entry
- Since:
- 2.0
-
newProjectRuntimeClasspathEntry
public static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(IJavaProject project, int classpathProperty) Returns a new runtime classpath entry for the given project.- Parameters:
project
- Java projectclasspathProperty
- the type of entry - one ofUSER_CLASSES
,BOOTSTRAP_CLASSES
,STANDARD_CLASSES
,MODULE_PATH
orCLASS_PATH
- Returns:
- runtime classpath entry
- Since:
- 3.10
-
newArchiveRuntimeClasspathEntry
public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.resources.IResource resource) Returns a new runtime classpath entry for the given archive.- Parameters:
resource
- archive resource- Returns:
- runtime classpath entry
- Since:
- 2.0
-
newArchiveRuntimeClasspathEntry
public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path, int classpathProperty) Returns a new runtime classpath entry for the given archive(possibly external).- Parameters:
path
- absolute path to an archiveclasspathProperty
- the type of entry - one ofUSER_CLASSES
,BOOTSTRAP_CLASSES
,STANDARD_CLASSES
,MODULE_PATH
orCLASS_PATH
- Returns:
- runtime classpath entry
- Since:
- 3.10
-
newArchiveRuntimeClasspathEntry
public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path, int classpathProperty, IJavaProject javaProject) Returns a new runtime classpath entry for the given archive(possibly external).- Parameters:
path
- absolute path to an archiveclasspathProperty
- the type of entry - one ofUSER_CLASSES
,BOOTSTRAP_CLASSES
,STANDARD_CLASSES
,MODULE_PATH
,CLASS_PATH
orPATCH_MODULE
javaProject
- the javaProject to be returned byIRuntimeClasspathEntry.getJavaProject()
, required for PATCH_MODULE- Returns:
- runtime classpath entry
- Since:
- 3.10
-
newArchiveRuntimeClasspathEntry
public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path) Returns a new runtime classpath entry for the given archive (possibly external).- Parameters:
path
- absolute path to an archive- Returns:
- runtime classpath entry
- Since:
- 2.0
-
newArchiveRuntimeClasspathEntry
public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported) Returns a new runtime classpath entry for the given archive (possibly external).- Parameters:
path
- absolute path to an archivesourceAttachmentPath
- the absolute path of the corresponding source archive or folder, ornull
if none. Note, since 3.0, an empty path is allowed to denote no source attachment. and will be automatically converted tonull
. Since 3.4, this path can also denote a path external to the workspace.sourceAttachmentRootPath
- the location of the root of the source files within the source archive or folder ornull
if this location should be automatically detected.accessRules
- the possibly empty list of access rules for this entryextraAttributes
- the possibly empty list of extra attributes to persist with this entryisExported
- indicates whether this entry is contributed to dependent projects in addition to the output location- Returns:
- runtime classpath entry
- Since:
- 3.10
-
newVariableRuntimeClasspathEntry
public static IRuntimeClasspathEntry newVariableRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path) Returns a new runtime classpath entry for the classpath variable with the given path.- Parameters:
path
- variable path; first segment is the name of the variable; trailing segments are appended to the resolved variable value- Returns:
- runtime classpath entry
- Since:
- 2.0
-
newRuntimeContainerClasspathEntry
public static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path, int classpathProperty) throws org.eclipse.core.runtime.CoreException Returns a runtime classpath entry for the given container path with the given classpath property.- Parameters:
path
- container pathclasspathProperty
- the type of entry - one ofUSER_CLASSES
,BOOTSTRAP_CLASSES
,STANDARD_CLASSES
,MODULE_PATH
orCLASS_PATH
- Returns:
- runtime classpath entry
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to construct a runtime classpath entry- Since:
- 2.0
-
newRuntimeContainerClasspathEntry
public static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path, int classpathProperty, IJavaProject project) throws org.eclipse.core.runtime.CoreException Returns a runtime classpath entry for the given container path with the given classpath property to be resolved in the context of the given Java project.- Parameters:
path
- container pathclasspathProperty
- the type of entry - one ofUSER_CLASSES
,BOOTSTRAP_CLASSES
, orSTANDARD_CLASSES
project
- Java project context used for resolution, ornull
if to be resolved in the context of the launch configuration this entry is referenced in- Returns:
- runtime classpath entry
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to construct a runtime classpath entry- Since:
- 3.0
-
newRuntimeClasspathEntry
public static IRuntimeClasspathEntry newRuntimeClasspathEntry(String memento) throws org.eclipse.core.runtime.CoreException Returns a runtime classpath entry constructed from the given memento.- Parameters:
memento
- a memento for a runtime classpath entry- Returns:
- runtime classpath entry
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to construct a runtime classpath entry- Since:
- 2.0
-
computeUnresolvedRuntimeClasspath
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(IJavaProject project) throws org.eclipse.core.runtime.CoreException Computes and returns the default unresolved runtime classpath for the given project.- Parameters:
project
- theIJavaProject
to compute the unresolved runtime classpath for- Returns:
- runtime classpath entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the runtime classpath- Since:
- 2.0
- See Also:
-
computeUnresolvedRuntimeClasspath
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(IJavaProject project, boolean excludeTestCode) throws org.eclipse.core.runtime.CoreException Computes and returns the default unresolved runtime classpath for the given project.- Parameters:
project
- theIJavaProject
to compute the unresolved runtime classpath forexcludeTestCode
- if true, output folders corresponding to test sources and test dependencies are excluded- Returns:
- runtime classpath entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the runtime classpath- Since:
- 3.10
- See Also:
-
computeUnresolvedRuntimeDependencies
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeDependencies(IJavaProject project) throws org.eclipse.core.runtime.CoreException Computes and returns the default unresolved runtime classpath and modulepath for the given project.- Parameters:
project
- theIJavaProject
to compute the unresolved runtime classpath and modulepath for- Returns:
- runtime classpath and modulepath entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the runtime classpath and/or modulepath- Since:
- 3.10
- See Also:
-
computeUnresolvedRuntimeDependencies
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeDependencies(IJavaProject project, boolean excludeTestCode) throws org.eclipse.core.runtime.CoreException Computes and returns the default unresolved runtime classpath and modulepath for the given project.- Parameters:
project
- theIJavaProject
to compute the unresolved runtime classpath and modulepath forexcludeTestCode
- if true, output folders corresponding to test sources and test dependencies are excluded- Returns:
- runtime classpath and modulepath entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the runtime classpath and/or modulepath- Since:
- 3.10
- See Also:
-
isModule
Checks if classpath entry is modular and project is modular .- Parameters:
entry
- the classpath entry- Returns:
- boolean
true
if entry is module elsefalse
- Since:
- 3.10
-
isModularConfiguration
public static boolean isModularConfiguration(org.eclipse.debug.core.ILaunchConfiguration configuration) Checks if configuration JRE is greater than 8.- Parameters:
configuration
- the launch configuration- Returns:
- boolean
true
if jre used in configuration is greater than 8 elsefalse
- Since:
- 3.10
-
isModularJava
Checks if vm install is modular( version greater than 8).- Parameters:
vm
- the vm install- Returns:
- boolean
true
if vm install is modular elsefalse
- Since:
- 3.10
-
compareJavaVersions
Compares the version of vm and a version of the Java platform.- Parameters:
vm
- IVMInstall to be comparedver
- version to be compared- Returns:
- the value
0
if both versions are the same; a value less than0
ifvm
is smaller thanver
; and a value greater than0
ifvm
is higher thanver
; a value-1
in case of any exceptions; - Since:
- 3.10
-
isModularProject
Checks if project entry is modular- Parameters:
proj
- the project- Returns:
- boolean
true
if project is modular elsefalse
- Since:
- 3.10
-
computeUnresolvedSourceLookupPath
public static IRuntimeClasspathEntry[] computeUnresolvedSourceLookupPath(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Computes and returns the unresolved source lookup path for the given launch configuration.- Parameters:
configuration
- launch configuration- Returns:
- runtime classpath entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the source lookup path- Since:
- 2.0
-
resolveSourceLookupPath
public static IRuntimeClasspathEntry[] resolveSourceLookupPath(IRuntimeClasspathEntry[] entries, org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Resolves the given source lookup path, returning the resolved source lookup path in the context of the given launch configuration.- Parameters:
entries
- unresolved entriesconfiguration
- launch configuration- Returns:
- resolved entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to resolve the source lookup path- Since:
- 2.0
-
getClasspathProvider
public static IRuntimeClasspathProvider getClasspathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Returns the classpath provider for the given launch configuration.- Parameters:
configuration
- launch configuration- Returns:
- classpath provider
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to resolve the path provider- Since:
- 2.0
-
getSourceLookupPathProvider
public static IRuntimeClasspathProvider getSourceLookupPathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Returns the source lookup path provider for the given launch configuration.- Parameters:
configuration
- launch configuration- Returns:
- source lookup path provider
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to resolve the path provider- Since:
- 2.0
-
resolveRuntimeClasspathEntry
public static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Returns resolved entries for the given entry in the context of the given launch configuration. If the entry is of kindVARIABLE
orCONTAINER
, variable and container resolvers are consulted. If the entry is of kindPROJECT
, and the associated Java project specifies non-default output locations, the corresponding output locations are returned. Otherwise, the given entry is returned.If the given entry is a variable entry, and a resolver is not registered, the entry itself is returned. If the given entry is a container, and a resolver is not registered, resolved runtime classpath entries are calculated from the associated container classpath entries, in the context of the project associated with the given launch configuration.
- Parameters:
entry
- runtime classpath entryconfiguration
- launch configuration- Returns:
- resolved runtime classpath entry
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to resolve- Since:
- 2.0
- See Also:
-
resolveRuntimeClasspathEntry
public static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws org.eclipse.core.runtime.CoreException Returns resolved entries for the given entry in the context of the given Java project. If the entry is of kindVARIABLE
orCONTAINER
, variable and container resolvers are consulted. If the entry is of kindPROJECT
, and the associated Java project specifies non-default output locations, the corresponding output locations are returned. Otherwise, the given entry is returned.If the given entry is a variable entry, and a resolver is not registered, the entry itself is returned. If the given entry is a container, and a resolver is not registered, resolved runtime classpath entries are calculated from the associated container classpath entries, in the context of the given project.
- Parameters:
entry
- runtime classpath entryproject
- Java project context- Returns:
- resolved runtime classpath entry
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to resolve- Since:
- 2.0
- See Also:
-
resolveRuntimeClasspathEntry
public static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project, boolean excludeTestCode) throws org.eclipse.core.runtime.CoreException Returns resolved entries for the given entry in the context of the given Java project. If the entry is of kindVARIABLE
orCONTAINER
, variable and container resolvers are consulted. If the entry is of kindPROJECT
, and the associated Java project specifies non-default output locations, the corresponding output locations are returned. Otherwise, the given entry is returned.If the given entry is a variable entry, and a resolver is not registered, the entry itself is returned. If the given entry is a container, and a resolver is not registered, resolved runtime classpath entries are calculated from the associated container classpath entries, in the context of the given project.
- Parameters:
entry
- runtime classpath entryproject
- Java project contextexcludeTestCode
- if true, output folders corresponding to test sources and test dependencies are excluded- Returns:
- resolved runtime classpath entry
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to resolve- Since:
- 3.10
- See Also:
-
computeUnresolvedRuntimeClasspath
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Computes and returns the unresolved class path for the given launch configuration. Variable and container entries are unresolved.- Parameters:
configuration
- launch configuration- Returns:
- unresolved runtime classpath entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the classpath- Since:
- 2.0
-
resolveRuntimeClasspath
public static IRuntimeClasspathEntry[] resolveRuntimeClasspath(IRuntimeClasspathEntry[] entries, org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Resolves the given classpath, returning the resolved classpath in the context of the given launch configuration.- Parameters:
entries
- unresolved classpathconfiguration
- launch configuration- Returns:
- resolved runtime classpath entries
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the classpath- Since:
- 2.0
-
getJavaProject
public static IJavaProject getJavaProject(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Return theIJavaProject
referenced in the specified configuration ornull
if none. This method looks for the existence of theIJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME
attribute in the given configuration.- Parameters:
configuration
- theILaunchConfiguration
to try and compute theIJavaProject
from- Returns:
- the referenced
IJavaProject
ornull
- Throws:
org.eclipse.core.runtime.CoreException
- if the referenced Java project does not exist- Since:
- 2.0
-
computeVMInstall
public static IVMInstall computeVMInstall(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Returns the VM install for the given launch configuration. The VM install is determined in the following prioritized way:- The VM install is explicitly specified on the launch configuration
via the
ATTR_JRE_CONTAINER_PATH
attribute (since 3.2). - The VM install is explicitly specified on the launch configuration
via the
ATTR_VM_INSTALL_TYPE
andATTR_VM_INSTALL_ID
attributes. - If no explicit VM install is specified, the VM install associated with the launch configuration's project is returned.
- If no project is specified, or the project does not specify a custom VM install, the workspace default VM install is returned.
- Parameters:
configuration
- launch configuration- Returns:
- VM install
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute a VM install- Since:
- 2.0
- The VM install is explicitly specified on the launch configuration
via the
-
computeDefaultRuntimeClassPath
public static String[] computeDefaultRuntimeClassPath(IJavaProject jproject) throws org.eclipse.core.runtime.CoreException Computes the default application classpath entries for the given project.- Parameters:
jproject
- The project to compute the classpath for- Returns:
- The computed classpath. May be empty, but not null.
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the default classpath
-
saveVMConfiguration
public static void saveVMConfiguration() throws org.eclipse.core.runtime.CoreExceptionSaves the VM configuration information to the preferences. This includes the following information:- The list of all defined IVMInstall instances.
- The default VM
- Throws:
org.eclipse.core.runtime.CoreException
- if trying to save the current state of VMs encounters a problem
-
isContributedVMInstall
Returns whether the VM install with the specified id was contributed via the vmInstalls extension point.- Parameters:
id
- VM id- Returns:
- whether the VM install was contributed via extension point
- Since:
- 3.2
-
getLibraryLocations
Evaluates library locations for a IVMInstall. If no library locations are set on the install, a default location is evaluated and checked if it exists.- Parameters:
vm
- theIVMInstall
to compute locations for- Returns:
- library locations with paths that exist or are empty
- Since:
- 2.0
-
getJREVariableEntry
Creates and returns a classpath entry describing the JRE_LIB classpath variable.- Returns:
- a new IClasspathEntry that describes the JRE_LIB classpath variable
-
getDefaultJREContainerEntry
Creates and returns a classpath entry describing the default JRE container entry.- Returns:
- a new IClasspathEntry that describes the default JRE container entry
- Since:
- 2.0
-
newDefaultJREContainerPath
public static org.eclipse.core.runtime.IPath newDefaultJREContainerPath()Returns a path for the JRE classpath container identifying the default VM install.- Returns:
- classpath container path
- Since:
- 3.2
-
newJREContainerPath
Returns a path for the JRE classpath container identifying the specified VM install by type and name.- Parameters:
vm
- VM install- Returns:
- classpath container path
- Since:
- 3.2
-
newJREContainerPath
Returns a path for the JRE classpath container identifying the specified VM install by type and name.- Parameters:
typeId
- VM install type identifiername
- VM install name- Returns:
- classpath container path
- Since:
- 3.2
-
newJREContainerPath
Returns a path for the JRE classpath container identifying the specified execution environment.- Parameters:
environment
- execution environment- Returns:
- classpath container path
- Since:
- 3.2
-
getVMInstall
Returns the JRE referenced by the specified JRE classpath container path ornull
if none.- Parameters:
jreContainerPath
- the path to the container to try and resolve theIVMInstall
from- Returns:
- JRE referenced by the specified JRE classpath container
path or
null
- Since:
- 3.2
-
getVMInstallTypeId
Returns the identifier of the VM install type referenced by the given JRE classpath container path, ornull
if none.- Parameters:
jreContainerPath
- the path to the container to try and resolve theIVMInstallType
id from- Returns:
- VM install type identifier or
null
- Since:
- 3.2
-
getVMInstallName
Returns the name of the VM install referenced by the given JRE classpath container path, ornull
if none.- Parameters:
jreContainerPath
- the path to the container to try an resolve theIVMInstall
name from- Returns:
- VM name or
null
- Since:
- 3.2
-
getExecutionEnvironmentId
Returns the execution environment identifier in the following JRE classpath container path, ornull
if none.- Parameters:
jreContainerPath
- classpath container path- Returns:
- execution environment identifier or
null
- Since:
- 3.2
-
computeJREEntry
public static IRuntimeClasspathEntry computeJREEntry(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException Returns a runtime classpath entry identifying the JRE to use when launching the specified configuration ornull
if none is specified. The entry returned represents a either a classpath variable or classpath container that resolves to a JRE.The entry is resolved as follows:
- If the
ATTR_JRE_CONTAINER_PATH
is present, it is used to create a classpath container referring to a JRE. - Next, if the
ATTR_VM_INSTALL_TYPE
andATTR_VM_INSTALL_NAME
attributes are present, they are used to create a classpath container. - When none of the above attributes are specified, a default entry is created which refers to the JRE referenced by the build path of the configuration's associated Java project. This could be a classpath variable or classpath container.
- When there is no Java project associated with a configuration, the workspace default JRE is used to create a container path.
- Parameters:
configuration
- the backingILaunchConfiguration
- Returns:
- classpath container path identifying a JRE or
null
- Throws:
org.eclipse.core.runtime.CoreException
- if an exception occurs retrieving attributes from the specified launch configuration- Since:
- 3.2
- If the
-
computeJREEntry
public static IRuntimeClasspathEntry computeJREEntry(IJavaProject project) throws org.eclipse.core.runtime.CoreException Returns a runtime classpath entry identifying the JRE referenced by the specified project, ornull
if none. The entry returned represents a either a classpath variable or classpath container that resolves to a JRE.- Parameters:
project
- Java project- Returns:
- JRE runtime classpath entry or
null
- Throws:
org.eclipse.core.runtime.CoreException
- if an exception occurs accessing the project's classpath- Since:
- 3.2
-
computeModularJREEntry
public static IRuntimeClasspathEntry computeModularJREEntry(IJavaProject project) throws org.eclipse.core.runtime.CoreException Returns a runtime classpath or modulepath entry identifying the JRE referenced by the specified project, ornull
if none. The entry returned represents a either a classpath variable or classpath container that resolves to a JRE.- Parameters:
project
- Java project- Returns:
- JRE runtime classpath or modulepath entry or
null
- Throws:
org.eclipse.core.runtime.CoreException
- if an exception occurs accessing the project's classpath- Since:
- 3.10
-
isVMInstallReference
Returns whether the given runtime classpath entry refers to a VM install.- Parameters:
entry
- the entry to check- Returns:
- whether the given runtime classpath entry refers to a VM install
- Since:
- 3.2
-
getVMConnector
Returns the VM connector defined with the specified identifier, ornull
if none.- Parameters:
id
- VM connector identifier- Returns:
- VM connector or
null
if none - Since:
- 2.0
-
getVMConnectors
Returns all VM connector extensions.- Returns:
- VM connectors
- Since:
- 2.0
-
getPreferences
public static org.eclipse.core.runtime.Preferences getPreferences()Returns the preference store for the launching plug-in.- Returns:
- the preference store for the launching plug-in
- Since:
- 2.0
-
savePreferences
public static void savePreferences()Saves the preferences for the launching plug-in.- Since:
- 2.0
-
addVariableResolver
public static void addVariableResolver(IRuntimeClasspathEntryResolver resolver, String variableName) Registers the given resolver for the specified variable.- Parameters:
resolver
- runtime classpath entry resolvervariableName
- variable name to register for- Since:
- 2.0
-
addContainerResolver
public static void addContainerResolver(IRuntimeClasspathEntryResolver resolver, String containerIdentifier) Registers the given resolver for the specified container.- Parameters:
resolver
- runtime classpath entry resolvercontainerIdentifier
- identifier of the classpath container to register for- Since:
- 2.0
-
addVMInstallChangedListener
Adds the given listener to the list of registered VM install changed listeners. Has no effect if an identical listener is already registered.- Parameters:
listener
- the listener to add- Since:
- 2.0
-
removeVMInstallChangedListener
Removes the given listener from the list of registered VM install changed listeners. Has no effect if an identical listener is not already registered.- Parameters:
listener
- the listener to remove- Since:
- 2.0
-
fireVMChanged
Notifies all VM install changed listeners of the given property change.- Parameters:
event
- event describing the change.- Since:
- 2.0
-
fireVMAdded
Notifies all VM install changed listeners of the VM addition- Parameters:
vm
- the VM that has been added- Since:
- 2.0
-
fireVMRemoved
Notifies all VM install changed listeners of the VM removal- Parameters:
vm
- the VM that has been removed- Since:
- 2.0
-
getProjectOutputDirectory
Return the String representation of the default output directory of the launch config's project ornull
if there is no configuration, no project or some sort of problem.- Parameters:
config
- theILaunchConfiguration
- Returns:
- the default output directory for the specified launch configuration's project
- Since:
- 2.1
-
getSourceContainers
public static org.eclipse.debug.core.sourcelookup.ISourceContainer[] getSourceContainers(IRuntimeClasspathEntry[] entries) Returns a collection of source containers corresponding to the given resolved runtime classpath entries.Note that the entries must be resolved to ARCHIVE and PROJECT entries, as source containers cannot be determined for unresolved entries.
- Parameters:
entries
- entries to translate- Returns:
- source containers corresponding to the given runtime classpath entries
- Since:
- 3.1
-
computeJavaLibraryPath
public static String[] computeJavaLibraryPath(IJavaProject project, boolean requiredProjects) throws org.eclipse.core.runtime.CoreException Returns a collection of paths that should be appended to the given project'sjava.library.path
system property when launched. Entries are searched for on the project's build path as extra classpath attributes. Each entry represents an absolute path in the local file system.- Parameters:
project
- the project to compute thejava.library.path
forrequiredProjects
- whether to consider entries in required projects- Returns:
- a collection of paths representing entries that should be appended
to the given project's
java.library.path
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to compute the Java library path- Since:
- 3.1
- See Also:
-
newLibraryPathsAttribute
Creates a new classpath attribute referencing a list of shared libraries that should appear on the-Djava.library.path
system property at runtime for an associatedIClasspathEntry
.The factory methods
newLibraryPathsAttribute(String[])
andgetLibraryPaths(IClasspathAttribute)
should be used to encode and decode the attribute value.- Parameters:
paths
- an array of strings representing paths of shared libraries. Each string is used to create anIPath
using the constructorPath(String)
, and may containIStringVariable
's. Variable substitution is performed on each string before a path is constructed from a string.- Returns:
- a classpath attribute with the name
CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
and an value encoded to the specified paths. - Since:
- 3.1
-
getLibraryPaths
Returns an array of strings referencing shared libraries that should appear on the-Djava.library.path
system property at runtime for an associatedIClasspathEntry
, ornull
if the given attribute is not aCLASSPATH_ATTR_LIBRARY_PATH_ENTRY
. Each string is used to create anIPath
using the constructorPath(String)
, and may containIStringVariable
's.The factory methods
newLibraryPathsAttribute(String[])
andgetLibraryPaths(IClasspathAttribute)
should be used to encode and decode the attribute value.- Parameters:
attribute
- aCLASSPATH_ATTR_LIBRARY_PATH_ENTRY
classpath attribute- Returns:
- an array of strings referencing shared libraries that should
appear on the
-Djava.library.path
system property at runtime for an associatedIClasspathEntry
, ornull
if the given attribute is not aCLASSPATH_ATTR_LIBRARY_PATH_ENTRY
. Each string is used to create anIPath
using the constructorPath(String)
, and may containIStringVariable
's. - Since:
- 3.1
-
getExecutionEnvironmentsManager
Returns the execution environments manager.- Returns:
- execution environments manager
- Since:
- 3.2
-
createVMFromDefinitionFile
public static VMStandin createVMFromDefinitionFile(File eeFile, String name, String id) throws org.eclipse.core.runtime.CoreException Creates a new VM based on the attributes specified in the given execution environment description file. The format of the file is defined byhttp://wiki.eclipse.org/Execution_Environment_Descriptions
.- Parameters:
eeFile
- VM definition filename
- name for the VM, ornull
if a default name should be assignedid
- id to assign to the new VM- Returns:
- VM stand-in
- Throws:
org.eclipse.core.runtime.CoreException
- if unable to create a VM from the given definition file- Since:
- 3.4
-
getProvidedVMPackages
public static Set<String> getProvidedVMPackages(IVMInstall vm, String release) throws org.eclipse.core.runtime.CoreException Returns the names of all packages publicly exported by the givenvmInstall
, optionally restricted to the given release version.The returned set contains the distinct names sorted in alphabetical order.
The specified release is only considered formodular
VM-Installs, for non-modular installs it is ignored, and then must correspond to Java version 9 or higher.- Parameters:
vm
- the vm-install to queryrelease
- the release to restrict the packages to, ignored for non-modular VMs. Supported values are the constants defined inJavaCore.VERSION_X
, e.g."9"
,"10"
,"11"
or so on. Ifnull
, the VMInstall's release is used.- Returns:
- the distinct and alphabetically sorted immutable set of names of all packages in the VM
- Throws:
org.eclipse.core.runtime.CoreException
- if an error occurs or a modular VM is queried for packages of Java-8 or lower- Since:
- 3.22
-
getModuleCLIOptions
Returns the module-related command line options for the configuration that are needed at runtime as equivalents of those options specified byIClasspathAttribute
s of the following names:IClasspathAttribute.PATCH_MODULE
is not handled here, but inAbstractJavaLaunchConfigurationDelegate.getModuleCLIOptions(ILaunchConfiguration)
, which then collates all options referring to the same module.- Since:
- 3.10
-
IProcess.ATTR_CMDLINE