org.apache.tools.ant.types
public class CommandlineJava extends Object implements Cloneable
Nested Class Summary | |
---|---|
static class | CommandlineJava.SysProperties
Specialized Environment class for System properties. |
Constructor Summary | |
---|---|
CommandlineJava()
Constructor uses the VM we are running on now. |
Method Summary | |
---|---|
void | addSysproperties(CommandlineJava.SysProperties sysp)
Add a set of system properties. |
void | addSysproperty(Environment.Variable sysp)
Add a system property. |
void | addSyspropertyset(PropertySet sysp)
Add a set of system properties. |
void | clearJavaArgs()
Clear out the java arguments. |
Object | clone()
Deep clone the object. |
Commandline.Argument | createArgument()
Create a new argument to the java program. |
Path | createBootclasspath(Project p)
Create a boot classpath. |
Path | createClasspath(Project p)
Create a classpath. |
Commandline.Argument | createVmArgument()
Create a new JVM argument. |
String | describeCommand()
Return a String that describes the command and arguments suitable for
verbose output before a call to Runtime.exec(String[]) |
String | describeJavaCommand()
Return a String that describes the java command and arguments
for in-VM executions.
|
protected Commandline | getActualVMCommand()
Get the VM command parameters, including memory settings. |
Assertions | getAssertions()
Get the current assertions. |
Path | getBootclasspath()
Get the boot classpath. |
String | getClassname()
Get the name of the class to be run. |
Path | getClasspath()
Get the classpath for the command. |
String[] | getCommandline()
Get the command line to run a Java vm. |
String | getJar()
Get the name of the jar to be run. |
Commandline | getJavaCommand()
Get the Java command to be used. |
CommandlineJava.SysProperties | getSystemProperties()
Get the system properties object. |
Commandline | getVmCommand()
Get the VM command, including memory. |
String | getVmversion()
Get the vm version. |
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).
|
protected boolean | haveClasspath()
Determine whether the classpath has been specified, and whether it shall
really be used or be nulled by build.sysclasspath. |
void | restoreSystemProperties()
Restore the cached system properties. |
void | setAssertions(Assertions assertions)
Add an assertion set to the command. |
void | setClassname(String classname)
Set the classname to execute. |
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. |
void | setJar(String jarpathname)
Set a jar file to execute via the -jar option. |
void | setMaxmemory(String max)
Specify max memory of the JVM.
|
void | setSystemProperties()
Cache current system properties and set them to those in this
Java command. |
void | setVm(String vm)
Set the executable used to start the new JVM. |
void | setVmversion(String value)
Set the JVM version required. |
int | size()
Get the size of the java command line. |
String | toString()
Get a string description. |
Parameters: sysp a set of properties.
Since: Ant 1.6.3
Parameters: sysp a property to be set in the JVM.
Parameters: sysp a set of properties.
Returns: a CommandlineJava object.
Throws: BuildException if anything went wrong. CloneNotSupportedException never.
Returns: an argument to be configured.
Parameters: p the project to use to create the path.
Returns: a path to be configured.
Since: Ant 1.6
Parameters: p the project to use to create the path.
Returns: a path to be configured.
Returns: an argument to be configured.
Runtime.exec(String[]).Returns: the description string.
Since: Ant 1.5
The class name is the executable in this context.
Returns: the description string.
Since: Ant 1.5
Returns: the VM command parameters.
Returns: assertions or null.
Returns: boot classpath or null.
Returns: the name of the class to run or null if there is no class.
See Also: getJar
Returns: the classpath or null.
Returns: the list of all arguments necessary to run the vm.
Returns: the pathname of the jar file to run via -jar option or null if there is no jar to run.
See Also: getClassname
Returns: the java command--not a clone.
Returns: The system properties object.
Returns: A deep clone of the instance's VM command, with memory settings added.
Returns: the vm version.
Parameters: log whether to log a warning if a bootclasspath has been specified but will be ignored.
Returns: true if the bootclasspath is to be used.
Since: Ant 1.6
Returns: true if the classpath is to be used.
Since: Ant 1.6
Throws: BuildException if Security prevented this operation, or there was no system properties to restore
Parameters: assertions assertions to make.
Parameters: classname the fully qualified classname.
Parameters: cloneVm if true copy the system properties.
Since: Ant 1.7
Parameters: jarpathname the pathname of the jar to execute.
Parameters: max the string to pass to the jvm to specifiy the max memory.
Throws: BuildException if Security prevented this operation.
Parameters: vm the executable to use.
Parameters: value the version required.
Deprecated: since 1.7. Please dont 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.Returns: the total number of arguments in the java command line.
See Also: getCommandline
Returns: the command line as a string.