public final class JavaRuntime extends Object
"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.
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_CMDLINE
Deprecated.
- use
IProcess.ATTR_CMDLINE |
static String |
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. |
static int |
DEF_CONNECT_TIMEOUT
Default launch/connect timeout (milliseconds).
|
static int |
ERR_UNABLE_TO_RESOLVE_JRE
A status code indicating that a JRE could not be resolved for a project.
|
static String |
EXTENSION_POINT_EXECUTION_ENVIRONMENTS
Simple identifier constant (value
"executionEnvironments" ) for the
execution environments extension point. |
static String |
EXTENSION_POINT_LIBRARY_LOCATION_RESOLVERS
Simple identifier constant (value
"libraryLocationResolvers" ) for the
Library Resolvers extension point |
static String |
EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS
Simple identifier constant (value
"runtimeClasspathEntryResolvers" ) for the
runtime classpath entry resolvers extension point. |
static String |
EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS
Simple identifier constant (value
"classpathProviders" ) for the
runtime classpath providers extension point. |
static String |
EXTENSION_POINT_VM_INSTALLS
Simple identifier constant (value
"vmInstalls" ) for the
VM installs extension point. |
static String |
ID_PLUGIN
Unique identifier constant (value
"org.eclipse.jdt.launching" )
for the Java launching plug-in. |
static String |
JRE_CONTAINER
Classpath container used for a project's JRE
(value
"org.eclipse.jdt.launching.JRE_CONTAINER" ). |
static String |
JRE_CONTAINER_MARKER
Marker type identifier for JRE container problems.
|
static String |
JRELIB_VARIABLE
Classpath variable name used for the default JRE's library
(value
"JRE_LIB" ). |
static String |
JRESRC_VARIABLE
Classpath variable name used for the default JRE's library source
(value
"JRE_SRC" ). |
static String |
JRESRCROOT_VARIABLE
Classpath variable name used for the default JRE's library source root
(value
"JRE_SRCROOT" ). |
static String |
PREF_CONNECT_TIMEOUT
Preference key for launch/connect timeout.
|
static String |
PREF_ONLY_INCLUDE_EXPORTED_CLASSPATH_ENTRIES
Boolean preference controlling whether only exported entries should even be included when the runtime classpath is computed
|
static String |
PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE
Preference key for the default 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 String |
PREF_VM_XML
Preference key for the String of XML that defines all installed VMs.
|
Modifier and Type | Method and Description |
---|---|
static 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 |
addVMInstallChangedListener(IVMInstallChangedListener listener)
Adds the given listener to the list of registered VM install changed
listeners.
|
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's
java.library.path system property when launched. |
static IRuntimeClasspathEntry |
computeJREEntry(IJavaProject project)
Returns a runtime classpath entry identifying the JRE referenced by the specified
project, or
null if none. |
static IRuntimeClasspathEntry |
computeJREEntry(ILaunchConfiguration configuration)
Returns a runtime classpath entry identifying the JRE to use when launching the specified
configuration or
null if none is specified. |
static IRuntimeClasspathEntry[] |
computeUnresolvedRuntimeClasspath(IJavaProject project)
Computes and returns the default unresolved runtime classpath for the
given project.
|
static IRuntimeClasspathEntry[] |
computeUnresolvedRuntimeClasspath(ILaunchConfiguration configuration)
Computes and returns the unresolved class path for the given launch configuration.
|
static IRuntimeClasspathEntry[] |
computeUnresolvedSourceLookupPath(ILaunchConfiguration configuration)
Computes and returns the unresolved source lookup path for the given launch
configuration.
|
static IVMInstall |
computeVMInstall(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 |
fireVMAdded(IVMInstall vm)
Notifies all VM install changed listeners of the VM addition
|
static void |
fireVMChanged(PropertyChangeEvent event)
Notifies all VM install changed listeners of the given property change.
|
static void |
fireVMRemoved(IVMInstall vm)
Notifies all VM install changed listeners of the VM removal
|
static IRuntimeClasspathProvider |
getClasspathProvider(ILaunchConfiguration configuration)
Returns the classpath provider for the given launch configuration.
|
static String |
getCompositeIdFromVM(IVMInstall vm)
Returns a String that uniquely identifies the specified VM across all VM types.
|
static IClasspathEntry |
getDefaultJREContainerEntry()
Creates and returns a classpath entry describing
the default JRE container entry.
|
static IVMConnector |
getDefaultVMConnector()
Return the default VM connector.
|
static IVMInstall |
getDefaultVMInstall()
Return the default VM set with
setDefaultVM() . |
static String |
getExecutionEnvironmentId(IPath jreContainerPath)
Returns the execution environment identifier in the following JRE
classpath container path, or
null if none. |
static IExecutionEnvironmentsManager |
getExecutionEnvironmentsManager()
Returns the execution environments manager.
|
static IJavaProject |
getJavaProject(ILaunchConfiguration configuration)
Return the
IJavaProject referenced in the specified configuration or
null if none. |
static IClasspathEntry |
getJREVariableEntry()
Creates and returns a classpath entry describing
the JRE_LIB classpath variable.
|
static LibraryLocation[] |
getLibraryLocations(IVMInstall vm)
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 associated IClasspathEntry , or null if the
given attribute is not a CLASSPATH_ATTR_LIBRARY_PATH_ENTRY . |
static Preferences |
getPreferences()
Returns the preference store for the launching plug-in.
|
static String |
getProjectOutputDirectory(ILaunchConfiguration config)
Return the String representation of the default output directory of the
launch config's project or
null if there is no configuration, no
project or some sort of problem. |
static ISourceContainer[] |
getSourceContainers(IRuntimeClasspathEntry[] entries)
Returns a collection of source containers corresponding to the given
resolved runtime classpath entries.
|
static IRuntimeClasspathProvider |
getSourceLookupPathProvider(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,
or
null if none. |
static IVMConnector[] |
getVMConnectors()
Returns all VM connector extensions.
|
static IVMInstall |
getVMFromCompositeId(String idString)
Return the VM corresponding to the specified composite Id.
|
static IVMInstall |
getVMInstall(IJavaProject project)
Returns the VM assigned to build the given Java project.
|
static IVMInstall |
getVMInstall(IPath jreContainerPath)
Returns the JRE referenced by the specified JRE classpath container
path or
null if none. |
static String |
getVMInstallName(IPath jreContainerPath)
Returns the name of the VM install referenced by the
given JRE classpath container path, or
null if none. |
static IVMInstallType |
getVMInstallType(String id)
Returns the VM install type with the given unique id.
|
static String |
getVMInstallTypeId(IPath jreContainerPath)
Returns the identifier of the VM install type referenced by the
given JRE classpath container path, or
null if none. |
static IVMInstallType[] |
getVMInstallTypes()
Returns the list of registered VM types.
|
static boolean |
isContributedVMInstall(String id)
Returns whether the VM install with the specified id was contributed via
the vmInstalls extension point.
|
static boolean |
isVMInstallReference(IRuntimeClasspathEntry entry)
Returns whether the given runtime classpath entry refers to a VM install.
|
static IRuntimeClasspathEntry |
newArchiveRuntimeClasspathEntry(IPath path)
Returns a new runtime classpath entry for the given archive (possibly
external).
|
static IRuntimeClasspathEntry |
newArchiveRuntimeClasspathEntry(IResource resource)
Returns a new runtime classpath entry for the given archive.
|
static IPath |
newDefaultJREContainerPath()
Returns a path for the JRE classpath container identifying the
default VM install.
|
static IRuntimeClasspathEntry |
newDefaultProjectClasspathEntry(IJavaProject project)
Returns a new runtime classpath entry containing the default classpath
for the specified Java project.
|
static IPath |
newJREContainerPath(IExecutionEnvironment environment)
Returns a path for the JRE classpath container identifying the
specified execution environment.
|
static IPath |
newJREContainerPath(IVMInstall vm)
Returns a path for the JRE classpath container identifying the
specified VM install by type and name.
|
static IPath |
newJREContainerPath(String typeId,
String name)
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 associated IClasspathEntry . |
static IRuntimeClasspathEntry |
newProjectRuntimeClasspathEntry(IJavaProject project)
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(IPath path,
int classpathProperty)
Returns a runtime classpath entry for the given container path with the given
classpath property.
|
static IRuntimeClasspathEntry |
newRuntimeContainerClasspathEntry(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(IPath path)
Returns a new runtime classpath entry for the classpath
variable with the given path.
|
static void |
removeVMInstallChangedListener(IVMInstallChangedListener listener)
Removes the given listener from the list of registered VM install changed
listeners.
|
static IRuntimeClasspathEntry[] |
resolveRuntimeClasspath(IRuntimeClasspathEntry[] entries,
ILaunchConfiguration configuration)
Resolves the given classpath, returning the resolved classpath
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,
ILaunchConfiguration configuration)
Returns resolved entries for the given entry in the context of the given
launch configuration.
|
static IRuntimeClasspathEntry[] |
resolveSourceLookupPath(IRuntimeClasspathEntry[] entries,
ILaunchConfiguration configuration)
Resolves the given source lookup path, returning the resolved source lookup path
in the context of the given launch configuration.
|
static void |
savePreferences()
Saves the preferences for the launching plug-in.
|
static void |
saveVMConfiguration()
Saves the VM configuration information to the preferences.
|
static void |
setDefaultVMConnector(IVMConnector connector,
IProgressMonitor monitor)
Sets a VM connector as the system-wide default VM.
|
static void |
setDefaultVMInstall(IVMInstall vm,
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,
IProgressMonitor monitor,
boolean savePreference)
Sets a VM as the system-wide default VM, and notifies registered VM install
change listeners of the change.
|
public static final String JRELIB_VARIABLE
"JRE_LIB"
).public static final String JRESRC_VARIABLE
"JRE_SRC"
).public static final String JRESRCROOT_VARIABLE
"JRE_SRCROOT"
).public static final String EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS
"runtimeClasspathEntryResolvers"
) for the
runtime classpath entry resolvers extension point.public static final String EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS
"classpathProviders"
) for the
runtime classpath providers extension point.public static final String EXTENSION_POINT_EXECUTION_ENVIRONMENTS
"executionEnvironments"
) for the
execution environments extension point.public static final String EXTENSION_POINT_VM_INSTALLS
"vmInstalls"
) for the
VM installs extension point.public static final String EXTENSION_POINT_LIBRARY_LOCATION_RESOLVERS
"libraryLocationResolvers"
) for the
Library Resolvers extension pointpublic static final String JRE_CONTAINER
"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:
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:
executionEnvironments
)public static final String JRE_CONTAINER_MARKER
public static final int ERR_UNABLE_TO_RESOLVE_JRE
source
object provided
to the status handler is the Java project for which the path could not be
resolved. The status handler must return an IVMInstall
or null
.
The container resolver will re-set the project's classpath if required.public static final String PREF_CONNECT_TIMEOUT
public static final String PREF_VM_XML
public static final String PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE
JavaCore.ERROR
, JavaCore.WARNING
, or
JavaCore.IGNORE
public static final String ID_PLUGIN
"org.eclipse.jdt.launching"
)
for the Java launching plug-in.public static final int DEF_CONNECT_TIMEOUT
@Deprecated public static final String ATTR_CMDLINE
IProcess.ATTR_CMDLINE
org.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 of IVMRunner
should use
this attribute key to attach the command lines to the processes they create.public static final String PREF_ONLY_INCLUDE_EXPORTED_CLASSPATH_ENTRIES
public static final String CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
-Djava.library.path
system property.
The factory methods newLibraryPathsAttribute(String[])
and getLibraryPaths(IClasspathAttribute)
should be used to
encode and decode the attribute value.
Each string is used to create an IPath
using the constructor
Path(String)
, and may contain IStringVariable
's.
Variable substitution is performed on the string prior to constructing
a path from the string.
If the resulting IPath
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.
IClasspathAttribute
public static IVMInstall getVMInstall(IJavaProject project) throws CoreException
project
- the project to retrieve the VM fromnull
if no VM is referenced on the project's build path.CoreException
- if unable to determine the project's VM installpublic static IVMInstallType getVMInstallType(String id)
id
- the VM install type unique idnull
if no
VM install type with the given id is registered.public static void setDefaultVMInstall(IVMInstall vm, IProgressMonitor monitor) throws CoreException
vm
- The VM to make the default. May be null
to clear
the default.monitor
- progress monitor or null
CoreException
- if trying to set the default VM install encounters problemspublic static void setDefaultVMInstall(IVMInstall vm, IProgressMonitor monitor, boolean savePreference) throws CoreException
vm
- The VM to make the default. May be null
to clear
the default.monitor
- progress monitor or null
savePreference
- If true
, update workbench preferences to reflect
the new default VM.CoreException
- if trying to set the default VM install encounters problemspublic static void setDefaultVMConnector(IVMConnector connector, IProgressMonitor monitor) throws CoreException
connector
- The connector to make the default. May be null
to clear
the default.monitor
- The progress monitor to useCoreException
- Thrown if saving the new default setting failspublic static IVMInstall getDefaultVMInstall()
setDefaultVM()
.null
when no default
VM was set or when the default VM has been disposed.public static IVMConnector getDefaultVMConnector()
public static IVMInstallType[] getVMInstallTypes()
"org.eclipse.jdt.launching.vmTypes"
extension point.
Returns an empty list if there are no registered VM types.public static String getCompositeIdFromVM(IVMInstall vm)
vm
- the instance of IVMInstallType to be identifiedpublic static IVMInstall getVMFromCompositeId(String idString)
idString
- the composite id that specifies an instance of IVMInstallpublic static IRuntimeClasspathEntry newStringVariableClasspathEntry(String expression)
expression
- an expression that resolves to the location of an archivepublic static IRuntimeClasspathEntry newDefaultProjectClasspathEntry(IJavaProject project)
project
- Java projectpublic static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(IJavaProject project)
project
- Java projectpublic static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IResource resource)
resource
- archive resourcepublic static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(IPath path)
path
- absolute path to an archivepublic static IRuntimeClasspathEntry newVariableRuntimeClasspathEntry(IPath path)
path
- variable path; first segment is the name of the variable;
trailing segments are appended to the resolved variable valuepublic static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(IPath path, int classpathProperty) throws CoreException
path
- container pathclasspathProperty
- the type of entry - one of USER_CLASSES
,
BOOTSTRAP_CLASSES
, or STANDARD_CLASSES
CoreException
- if unable to construct a runtime classpath entrypublic static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(IPath path, int classpathProperty, IJavaProject project) throws CoreException
path
- container pathclasspathProperty
- the type of entry - one of USER_CLASSES
,
BOOTSTRAP_CLASSES
, or STANDARD_CLASSES
project
- Java project context used for resolution, or null
if to be resolved in the context of the launch configuration this entry
is referenced inCoreException
- if unable to construct a runtime classpath entrypublic static IRuntimeClasspathEntry newRuntimeClasspathEntry(String memento) throws CoreException
memento
- a memento for a runtime classpath entryCoreException
- if unable to construct a runtime classpath entrypublic static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(IJavaProject project) throws CoreException
project
- the IJavaProject
to compute the unresolved runtime classpath forCoreException
- if unable to compute the runtime classpathIRuntimeClasspathEntry
public static IRuntimeClasspathEntry[] computeUnresolvedSourceLookupPath(ILaunchConfiguration configuration) throws CoreException
configuration
- launch configurationCoreException
- if unable to compute the source lookup pathpublic static IRuntimeClasspathEntry[] resolveSourceLookupPath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException
entries
- unresolved entriesconfiguration
- launch configurationCoreException
- if unable to resolve the source lookup pathpublic static IRuntimeClasspathProvider getClasspathProvider(ILaunchConfiguration configuration) throws CoreException
configuration
- launch configurationCoreException
- if unable to resolve the path providerpublic static IRuntimeClasspathProvider getSourceLookupPathProvider(ILaunchConfiguration configuration) throws CoreException
configuration
- launch configurationCoreException
- if unable to resolve the path providerpublic static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException
VARIABLE
or CONTAINER
, variable and container
resolvers are consulted. If the entry is of kind PROJECT
,
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.
entry
- runtime classpath entryconfiguration
- launch configurationCoreException
- if unable to resolveIRuntimeClasspathEntryResolver
public static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws CoreException
VARIABLE
or CONTAINER
, variable and container
resolvers are consulted. If the entry is of kind PROJECT
,
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.
entry
- runtime classpath entryproject
- Java project contextCoreException
- if unable to resolveIRuntimeClasspathEntryResolver
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(ILaunchConfiguration configuration) throws CoreException
configuration
- launch configurationCoreException
- if unable to compute the classpathpublic static IRuntimeClasspathEntry[] resolveRuntimeClasspath(IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) throws CoreException
entries
- unresolved classpathconfiguration
- launch configurationCoreException
- if unable to compute the classpathpublic static IJavaProject getJavaProject(ILaunchConfiguration configuration) throws CoreException
IJavaProject
referenced in the specified configuration or
null
if none. This method looks for the existence of the IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME
attribute in the given configuration.configuration
- the ILaunchConfiguration
to try and compute the IJavaProject
fromIJavaProject
or null
CoreException
- if the referenced Java project does not existpublic static IVMInstall computeVMInstall(ILaunchConfiguration configuration) throws CoreException
ATTR_JRE_CONTAINER_PATH
attribute (since 3.2).ATTR_VM_INSTALL_TYPE
and ATTR_VM_INSTALL_ID
attributes.configuration
- launch configurationCoreException
- if unable to compute a VM installpublic static String[] computeDefaultRuntimeClassPath(IJavaProject jproject) throws CoreException
jproject
- The project to compute the classpath forCoreException
- if unable to compute the default classpathpublic static void saveVMConfiguration() throws CoreException
CoreException
- if trying to save the current state of VMs encounters a problempublic static boolean isContributedVMInstall(String id)
id
- VM idpublic static LibraryLocation[] getLibraryLocations(IVMInstall vm)
vm
- the IVMInstall
to compute locations forpublic static IClasspathEntry getJREVariableEntry()
public static IClasspathEntry getDefaultJREContainerEntry()
public static IPath newDefaultJREContainerPath()
public static IPath newJREContainerPath(IVMInstall vm)
vm
- VM installpublic static IPath newJREContainerPath(String typeId, String name)
typeId
- VM install type identifiername
- VM install namepublic static IPath newJREContainerPath(IExecutionEnvironment environment)
environment
- execution environmentpublic static IVMInstall getVMInstall(IPath jreContainerPath)
null
if none.jreContainerPath
- the path to the container to try and resolve the IVMInstall
fromnull
public static String getVMInstallTypeId(IPath jreContainerPath)
null
if none.jreContainerPath
- the path to the container to try and resolve the IVMInstallType
id fromnull
public static String getVMInstallName(IPath jreContainerPath)
null
if none.jreContainerPath
- the path to the container to try an resolve the IVMInstall
name fromnull
public static String getExecutionEnvironmentId(IPath jreContainerPath)
null
if none.jreContainerPath
- classpath container pathnull
public static IRuntimeClasspathEntry computeJREEntry(ILaunchConfiguration configuration) throws CoreException
null
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:
ATTR_JRE_CONTAINER_PATH
is present, it is used to create
a classpath container referring to a JRE.ATTR_VM_INSTALL_TYPE
and ATTR_VM_INSTALL_NAME
attributes are present, they are used to create a classpath container.configuration
- the backing ILaunchConfiguration
null
CoreException
- if an exception occurs retrieving
attributes from the specified launch configurationpublic static IRuntimeClasspathEntry computeJREEntry(IJavaProject project) throws CoreException
null
if none. The entry returned represents a either a
classpath variable or classpath container that resolves to a JRE.project
- Java projectnull
CoreException
- if an exception occurs
accessing the project's classpathpublic static boolean isVMInstallReference(IRuntimeClasspathEntry entry)
entry
- the entry to checkpublic static IVMConnector getVMConnector(String id)
null
if none.id
- VM connector identifiernull
if nonepublic static IVMConnector[] getVMConnectors()
public static Preferences getPreferences()
public static void savePreferences()
public static void addVariableResolver(IRuntimeClasspathEntryResolver resolver, String variableName)
resolver
- runtime classpath entry resolvervariableName
- variable name to register forpublic static void addContainerResolver(IRuntimeClasspathEntryResolver resolver, String containerIdentifier)
resolver
- runtime classpath entry resolvercontainerIdentifier
- identifier of the classpath container to register forpublic static void addVMInstallChangedListener(IVMInstallChangedListener listener)
listener
- the listener to addpublic static void removeVMInstallChangedListener(IVMInstallChangedListener listener)
listener
- the listener to removepublic static void fireVMChanged(PropertyChangeEvent event)
event
- event describing the change.public static void fireVMAdded(IVMInstall vm)
vm
- the VM that has been addedpublic static void fireVMRemoved(IVMInstall vm)
vm
- the VM that has been removedpublic static String getProjectOutputDirectory(ILaunchConfiguration config)
null
if there is no configuration, no
project or some sort of problem.config
- the ILaunchConfiguration
public static ISourceContainer[] getSourceContainers(IRuntimeClasspathEntry[] entries)
Note that the entries must be resolved to ARCHIVE and PROJECT entries, as source containers cannot be determined for unresolved entries.
entries
- entries to translatepublic static String[] computeJavaLibraryPath(IJavaProject project, boolean requiredProjects) throws CoreException
java.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.project
- the project to compute the java.library.path
forrequiredProjects
- whether to consider entries in required projectsjava.library.path
CoreException
- if unable to compute the Java library pathIClasspathAttribute
,
CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
public static IClasspathAttribute newLibraryPathsAttribute(String[] paths)
-Djava.library.path
system property at runtime
for an associated IClasspathEntry
.
The factory methods newLibraryPathsAttribute(String[])
and getLibraryPaths(IClasspathAttribute)
should be used to
encode and decode the attribute value.
paths
- an array of strings representing paths of shared libraries.
Each string is used to create an IPath
using the constructor
Path(String)
, and may contain IStringVariable
's.
Variable substitution is performed on each string before a path is constructed
from a string.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
and an value encoded to the specified paths.public static String[] getLibraryPaths(IClasspathAttribute attribute)
-Djava.library.path
system property at runtime
for an associated IClasspathEntry
, or null
if the
given attribute is not a CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
.
Each string is used to create an IPath
using the constructor
Path(String)
, and may contain IStringVariable
's.
The factory methods newLibraryPathsAttribute(String[])
and getLibraryPaths(IClasspathAttribute)
should be used to
encode and decode the attribute value.
attribute
- a CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
classpath attribute-Djava.library.path
system property at runtime
for an associated IClasspathEntry
, or null
if the
given attribute is not a CLASSPATH_ATTR_LIBRARY_PATH_ENTRY
.
Each string is used to create an IPath
using the constructor
Path(String)
, and may contain IStringVariable
's.public static IExecutionEnvironmentsManager getExecutionEnvironmentsManager()
public static VMStandin createVMFromDefinitionFile(File eeFile, String name, String id) throws CoreException
http://wiki.eclipse.org/Execution_Environment_Descriptions
.eeFile
- VM definition filename
- name for the VM, or null
if a default name should be assignedid
- id to assign to the new VMCoreException
- if unable to create a VM from the given definition file
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.