Commandlines. One is used for the
vm/options and one for the classname/arguments. It provides
specific methods for a Java command line.
| Modifier and Type | Class and Description |
|---|---|
| private static enum | CommandlineJava.
Type of execution. |
| public static class | CommandlineJava.
Specialized Environment class for System properties. |
| Modifier and Type | Field and Description |
|---|---|
| private Assertions | assertions
any assertions to make? |
| private Path | |
| private Path | |
| private boolean | cloneVm
Whether system properties and bootclasspath shall be cloned. |
| private CommandlineJava. | executableType
Indicate whether it will execute a jar file, module or main class. |
| private Commandline | javaCommand
actual java commands |
| private String | |
| private Path | |
| private CommandlineJava. | sysProperties
properties to add using -D |
| private Path | |
| private Commandline | vmCommand
commands to the JVM |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | addCommandsToList(final ListIterator<String>
an iterator that supports the add method. listIterator)Add all the commands to a list identified by the iterator passed in. |
| public void | addSysproperties(CommandlineJava.
a set of properties. syspAdd a set of system properties. |
| public void | |
| public void | |
| private Path | calculateBootclasspath(boolean
whether to write messages to the log. log)Calculate the bootclasspath based on the bootclasspath specified, the build.sysclasspath and ant.build.clonevm magic properties as well as the cloneVm attribute. |
| public void | |
| public Object | |
| public Commandline. | |
| public Path | Returns: a path to be configured.the project to use to create the path. p)Create a boot classpath. |
| public Path | Returns: a path to be configured.the project to use to create the path. p)Create a classpath. |
| private static String | Returns: the main module with optional classname command line argument.the module name. module, final String the classname or classname)null.Creates JDK 9 main module command line argument. |
| public Path | Returns: a path to be configured.the project to use to create the path. p)Create a modulepath. |
| public Path | Returns: a path to be configured.the project to use to create the path. p)Create an upgrademodulepath. |
| public Commandline. | |
| public String | Returns: the description string.Return a String that describes the command and arguments suitable for
verbose output before a call to |
| public String | Returns: the description string.Return a String that describes the java command and arguments for in-VM executions. |
| protected Commandline | Returns: the VM command parameters.Get the VM command parameters, including memory settings. |
| public Assertions | |
| public Path | |
| public String | Returns: the name of the class to run ornull if there is no class.Get the name of the class to be run. |
| public Path | |
| public String[] | Returns: the list of all arguments necessary to run the vm.Get the command line to run a Java vm. |
| public String | Returns: the pathname of the jar file to run via -jar option ornull if there is no jar to run.Get the name of the jar to be run. |
| public Commandline | |
| public String | Returns: the name of the module to run ornull if there is no module.Get the name of the module to be run. |
| public Path | |
| public String | Returns: Returns the source-file to execute, if this command line has beenconfigured for single file source program
execution. Else returns null.
|
| public CommandlineJava. | |
| public Path | |
| public Commandline | Returns: A deep clone of the instance's VM command, with memory settings added.Get the VM command, including memory. |
| public String | |
| protected boolean | Returns: true if the bootclasspath is to be used.whether to log a warning if a bootclasspath has been
specified but will be ignored. log)Determine whether the bootclasspath has been specified, and whether it shall really be used (build.sysclasspath could be set or the VM may not support it). |
| public boolean | Returns: true if the classpath is to be used.Determine whether the classpath has been specified, and whether it shall really be used or be nulled by build.sysclasspath. |
| public boolean | Returns: true if the modulepath is to be used.Determine whether the modulepath has been specified. |
| public boolean | Returns: true if the upgrademodulepath is to be used.Determine whether the upgrademodulepath has been specified. |
| private boolean | Returns: boolean.Find out whether either of the cloneVm attribute or the magic property ant.build.clonevm has been set. |
| private static String | Returns: the classname ornull.a module with optional classname or moduleClassPair)null.Parses a classname from JDK 9 main module command line argument. |
| private static String | Returns: the module name ornull.a module with optional classname or moduleClassPair)null.Parses a module name from JDK 9 main module command line argument. |
| public void | |
| public void | |
| public void | |
| public void | setCloneVm(boolean
if true copy the system properties. cloneVm)Set whether system properties will be copied to the cloned VM--as well as the bootclasspath unless you have explicitly specified a bootclasspath. |
| public void | |
| public void | setMaxmemory(String
the string to pass to the jvm to specify the max memory. max)Specify max memory of the JVM. |
| public void | |
| public void | setSourceFile(final String
The path to the source file sourceFile)Set the source-file, to execute as single file source programs, a feature, available since Java 11. |
| public void | |
| public void | |
| public void | |
| public int | Returns: the total number of arguments in the java command line.
Deprecated
since 1.7.
Please don't use this, it effectively creates the
entire command.
Get the size of the java command line.
|
| public String | Returns: the command line as a string.Overrides java. |
| assertions | back to summary |
|---|---|
| private Assertions assertions any assertions to make? Currently only supported in forked JVMs | |
| bootclasspath | back to summary |
|---|---|
| private Path bootclasspath | |
| classpath | back to summary |
|---|---|
| private Path classpath | |
| cloneVm | back to summary |
|---|---|
| private boolean cloneVm Whether system properties and bootclasspath shall be cloned.
| |
| executableType | back to summary |
|---|---|
| private CommandlineJava. Indicate whether it will execute a jar file, module or main class. In this case of jar the first vm option must be a -jar and the 'executable' is a jar file. In case of module the first vm option is -m and the 'executable' is 'module/mainClass'. | |
| javaCommand | back to summary |
|---|---|
| private Commandline javaCommand actual java commands | |
| maxMemory | back to summary |
|---|---|
| private String maxMemory | |
| modulepath | back to summary |
|---|---|
| private Path modulepath | |
| sysProperties | back to summary |
|---|---|
| private CommandlineJava. properties to add using -D | |
| upgrademodulepath | back to summary |
|---|---|
| private Path upgrademodulepath | |
| vmCommand | back to summary |
|---|---|
| private Commandline vmCommand commands to the JVM | |
| vmVersion | back to summary |
|---|---|
| private String vmVersion | |
| CommandlineJava | back to summary |
|---|---|
| public CommandlineJava() Constructor uses the VM we are running on now. | |
| addCommandsToList | back to summary |
|---|---|
| private void addCommandsToList(final ListIterator<String> listIterator) Add all the commands to a list identified by the iterator passed in.
| |
| addSysproperties | back to summary |
|---|---|
| public void addSysproperties(CommandlineJava. Add a set of system properties.
| |
| addSysproperty | back to summary |
|---|---|
| public void addSysproperty(Environment. Add a system property.
| |
| addSyspropertyset | back to summary |
|---|---|
| public void addSyspropertyset(PropertySet sysp) Add a set of system properties.
| |
| calculateBootclasspath | back to summary |
|---|---|
| private Path calculateBootclasspath(boolean log) Calculate the bootclasspath based on the bootclasspath specified, the build.sysclasspath and ant.build.clonevm magic properties as well as the cloneVm attribute.
| |
| clearJavaArgs | back to summary |
|---|---|
| public void clearJavaArgs() Clear out the java arguments. | |
| clone | back to summary |
|---|---|
| public Object clone() throws CloneNotSupportedException Overrides java. Deep clone the object.
| |
| createArgument | back to summary |
|---|---|
| public Commandline. Create a new argument to the java program.
| |
| createBootclasspath | back to summary |
|---|---|
| public Path createBootclasspath(Project p) Create a boot classpath. | |
| createClasspath | back to summary |
|---|---|
| public Path createClasspath(Project p) Create a classpath. | |
| createModuleClassPair | back to summary |
|---|---|
| private static String createModuleClassPair(final String module, final String classname) Creates JDK 9 main module command line argument. | |
| createModulepath | back to summary |
|---|---|
| public Path createModulepath(Project p) Create a modulepath. | |
| createUpgrademodulepath | back to summary |
|---|---|
| public Path createUpgrademodulepath(Project p) Create an upgrademodulepath. | |
| createVmArgument | back to summary |
|---|---|
| public Commandline. Create a new JVM argument.
| |
| describeCommand | back to summary |
|---|---|
| public String describeCommand() Return a String that describes the command and arguments suitable for
verbose output before a call to
| |
| describeJavaCommand | back to summary |
|---|---|
| public String describeJavaCommand() Return a String that describes the java command and arguments for in-VM executions. The class name is the executable in this context.
| |
| getActualVMCommand | back to summary |
|---|---|
| protected Commandline getActualVMCommand() Get the VM command parameters, including memory settings.
| |
| getAssertions | back to summary |
|---|---|
| public Assertions getAssertions() Get the current assertions.
| |
| getBootclasspath | back to summary |
|---|---|
| public Path getBootclasspath() Get the boot classpath.
| |
| getClassname | back to summary |
|---|---|
| public String getClassname() Get the name of the class to be run. | |
| getClasspath | back to summary |
|---|---|
| public Path getClasspath() Get the classpath for the command.
| |
| getCommandline | back to summary |
|---|---|
| public String[] getCommandline() Get the command line to run a Java vm.
| |
| getJar | back to summary |
|---|---|
| public String getJar() Get the name of the jar to be run.
| |
| getJavaCommand | back to summary |
|---|---|
| public Commandline getJavaCommand() Get the Java command to be used.
| |
| getModule | back to summary |
|---|---|
| public String getModule() Get the name of the module to be run.
| |
| getModulepath | back to summary |
|---|---|
| public Path getModulepath() Get the modulepath.
| |
| getSourceFile | back to summary |
|---|---|
public String getSourceFile()
| |
| getSystemProperties | back to summary |
|---|---|
| public CommandlineJava. Get the system properties object.
| |
| getUpgrademodulepath | back to summary |
|---|---|
| public Path getUpgrademodulepath() Get the upgrademodulepath.
| |
| getVmCommand | back to summary |
|---|---|
| public Commandline getVmCommand() Get the VM command, including memory.
| |
| getVmversion | back to summary |
|---|---|
| public String getVmversion() Get the vm version.
| |
| haveBootclasspath | back to summary |
|---|---|
| protected boolean haveBootclasspath(boolean log) Determine whether the bootclasspath has been specified, and whether it shall really be used (build.sysclasspath could be set or the VM may not support it).
| |
| haveClasspath | back to summary |
|---|---|
| public boolean haveClasspath() Determine whether the classpath has been specified, and whether it shall really be used or be nulled by build.sysclasspath.
| |
| haveModulepath | back to summary |
|---|---|
| public boolean haveModulepath() Determine whether the modulepath has been specified.
| |
| haveUpgrademodulepath | back to summary |
|---|---|
| public boolean haveUpgrademodulepath() Determine whether the upgrademodulepath has been specified.
| |
| isCloneVm | back to summary |
|---|---|
| private boolean isCloneVm() Find out whether either of the cloneVm attribute or the magic property ant.build.clonevm has been set.
| |
| parseClassFromModuleClassPair | back to summary |
|---|---|
| private static String parseClassFromModuleClassPair(final String moduleClassPair) Parses a classname from JDK 9 main module command line argument. | |
| parseModuleFromModuleClassPair | back to summary |
|---|---|
| private static String parseModuleFromModuleClassPair(final String moduleClassPair) Parses a module name from JDK 9 main module command line argument. | |
| restoreSystemProperties | back to summary |
|---|---|
| public void restoreSystemProperties() throws BuildException Restore the cached system properties.
| |
| setAssertions | back to summary |
|---|---|
| public void setAssertions(Assertions assertions) Add an assertion set to the command.
| |
| setClassname | back to summary |
|---|---|
| public void setClassname(String classname) Set the classname to execute.
| |
| setCloneVm | back to summary |
|---|---|
| public void setCloneVm(boolean cloneVm) Set whether system properties will be copied to the cloned VM--as well as the bootclasspath unless you have explicitly specified a bootclasspath.
| |
| setJar | back to summary |
|---|---|
| public void setJar(String jarpathname) Set a jar file to execute via the -jar option.
| |
| setMaxmemory | back to summary |
|---|---|
| public void setMaxmemory(String max) Specify max memory of the JVM. -mx or -Xmx depending on VM version.
| |
| setModule | back to summary |
|---|---|
| public void setModule(final String module) Set the module to execute.
| |
| setSourceFile | back to summary |
|---|---|
| public void setSourceFile(final String sourceFile) Set the source-file, to execute as single file source programs, a feature, available since Java 11.
| |
| setSystemProperties | back to summary |
|---|---|
| public void setSystemProperties() throws BuildException Cache current system properties and set them to those in this Java command.
| |
| setVm | back to summary |
|---|---|
| public void setVm(String vm) Set the executable used to start the new JVM.
| |
| setVmversion | back to summary |
|---|---|
| public void setVmversion(String value) Set the JVM version required.
| |
| size | back to summary |
|---|---|
| public int size()
Deprecated since 1.7. Please don't use this, it effectively creates the entire command. Get the size of the java command line. This is a fairly intensive operation, as it has to evaluate the size of many components.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Get a string description. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final CommandlineJava. | CLASS
Main class execution. |
| public static final CommandlineJava. | JAR
Jar file execution. |
| public static final CommandlineJava. | MODULE
Module execution. |
| public static final CommandlineJava. | SOURCE_FILE
Source file (introduced in Java 11) |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static CommandlineJava. | |
| public static CommandlineJava. |
| CLASS | back to summary |
|---|---|
| public static final CommandlineJava. Main class execution. | |
| JAR | back to summary |
|---|---|
| public static final CommandlineJava. Jar file execution. | |
| MODULE | back to summary |
|---|---|
| public static final CommandlineJava. Module execution. | |
| SOURCE_FILE | back to summary |
|---|---|
| public static final CommandlineJava. Source file (introduced in Java 11) | |
| ExecutableType | back to summary |
|---|---|
| private ExecutableType() | |
| valueOf | back to summary |
|---|---|
| public static CommandlineJava. | |
| values | back to summary |
|---|---|
| public static CommandlineJava. | |
| Modifier and Type | Field and Description |
|---|---|
| private Vector | |
| pack-priv Properties | sys
the system properties. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addDefinitionsToList(ListIterator<String>
list iterator supporting add method. listIt)Add all definitions (including property sets) to a list. |
| public void | addSysproperties(CommandlineJava.
the new property set. psAdd a propertyset to the total set. |
| public void | |
| public Object | Returns: a cloned instance of SysProperties.Overrides java. |
| public String[] | Returns: the array of definitions; may be null.Overrides org. |
| private Properties | Returns: the merged object.Merge all property sets into a single Properties object. |
| public void | |
| public void | |
| public int |
| propertySets | back to summary |
|---|---|
| private Vector<PropertySet> propertySets | |
| sys | back to summary |
|---|---|
| pack-priv Properties sys the system properties. | |
| SysProperties | back to summary |
|---|---|
| public SysProperties() | |
| addDefinitionsToList | back to summary |
|---|---|
| public void addDefinitionsToList(ListIterator<String> listIt) Add all definitions (including property sets) to a list.
| |
| addSysproperties | back to summary |
|---|---|
| public void addSysproperties(CommandlineJava. Add a propertyset to the total set.
| |
| addSyspropertyset | back to summary |
|---|---|
| public void addSyspropertyset(PropertySet ps) Add a propertyset to the total set.
| |
| clone | back to summary |
|---|---|
| public Object clone() throws CloneNotSupportedException Overrides java. Create a deep clone.
| |
| getVariables | back to summary |
|---|---|
| public String[] getVariables() throws BuildException Overrides org. Get the properties as an array; this is an override of the superclass, as it evaluates all the properties.
| |
| mergePropertySets | back to summary |
|---|---|
| private Properties mergePropertySets() Merge all property sets into a single Properties object.
| |
| restoreSystem | back to summary |
|---|---|
| public void restoreSystem() throws BuildException Restore the system properties to the cached value.
| |
| setSystem | back to summary |
|---|---|
| public void setSystem() throws BuildException Cache the system properties and set the system properties to the new values.
| |
| size | back to summary |
|---|---|
| public int size() Get the size of the sysproperties instance. This merges all property sets, so is not an O(1) operation.
| |