java.lang.Cloneable
public class CommandlineJava
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Class | Description |
---|---|---|
static class |
CommandlineJava.SysProperties |
Specialized Environment class for System properties.
|
Constructor | Description |
---|---|
CommandlineJava() |
Constructor uses the VM we are running on now.
|
Modifier and Type | Method | Description |
---|---|---|
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.
|
java.lang.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.
|
Path |
createModulepath(Project p) |
Create a modulepath.
|
Path |
createUpgrademodulepath(Project p) |
Create an upgrademodulepath.
|
Commandline.Argument |
createVmArgument() |
Create a new JVM argument.
|
java.lang.String |
describeCommand() |
Return a String that describes the command and arguments suitable for
verbose output before a call to
Runtime.exec(String[]) . |
java.lang.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.
|
java.lang.String |
getClassname() |
Get the name of the class to be run.
|
Path |
getClasspath() |
Get the classpath for the command.
|
java.lang.String[] |
getCommandline() |
Get the command line to run a Java vm.
|
java.lang.String |
getJar() |
Get the name of the jar to be run.
|
Commandline |
getJavaCommand() |
Get the Java command to be used.
|
java.lang.String |
getModule() |
Get the name of the module to be run.
|
Path |
getModulepath() |
Get the modulepath.
|
java.lang.String |
getSourceFile() |
|
CommandlineJava.SysProperties |
getSystemProperties() |
Get the system properties object.
|
Path |
getUpgrademodulepath() |
Get the upgrademodulepath.
|
Commandline |
getVmCommand() |
Get the VM command, including memory.
|
java.lang.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).
|
boolean |
haveClasspath() |
Determine whether the classpath has been specified, and whether it shall
really be used or be nulled by build.sysclasspath.
|
boolean |
haveModulepath() |
Determine whether the modulepath has been specified.
|
boolean |
haveUpgrademodulepath() |
Determine whether the upgrademodulepath has been specified.
|
void |
restoreSystemProperties() |
Restore the cached system properties.
|
void |
setAssertions(Assertions assertions) |
Add an assertion set to the command.
|
void |
setClassname(java.lang.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(java.lang.String jarpathname) |
Set a jar file to execute via the -jar option.
|
void |
setMaxmemory(java.lang.String max) |
Specify max memory of the JVM.
|
void |
setModule(java.lang.String module) |
Set the module to execute.
|
void |
setSourceFile(java.lang.String sourceFile) |
Set the source-file, to execute as single file source programs, a feature, available
since Java 11.
|
void |
setSystemProperties() |
Cache current system properties and set them to those in this
Java command.
|
void |
setVm(java.lang.String vm) |
Set the executable used to start the new JVM.
|
void |
setVmversion(java.lang.String value) |
Set the JVM version required.
|
int |
size() |
Deprecated.
since 1.7.
|
java.lang.String |
toString() |
Get a string description.
|
public CommandlineJava()
public Commandline.Argument createArgument()
public Commandline.Argument createVmArgument()
public void addSysproperty(Environment.Variable sysp)
sysp
- a property to be set in the JVM.public void addSyspropertyset(PropertySet sysp)
sysp
- a set of properties.public void addSysproperties(CommandlineJava.SysProperties sysp)
sysp
- a set of properties.public void setVm(java.lang.String vm)
vm
- the executable to use.public void setVmversion(java.lang.String value)
value
- the version required.public void setCloneVm(boolean cloneVm)
cloneVm
- if true copy the system properties.public Assertions getAssertions()
public void setAssertions(Assertions assertions)
assertions
- assertions to make.public void setJar(java.lang.String jarpathname)
jarpathname
- the pathname of the jar to execute.public java.lang.String getJar()
getClassname()
public void setClassname(java.lang.String classname)
classname
- the fully qualified classname.public java.lang.String getClassname()
getJar()
public void setSourceFile(java.lang.String sourceFile)
sourceFile
- The path to the source filepublic java.lang.String getSourceFile()
configured for single file source program
execution
. Else returns null.public void setModule(java.lang.String module)
module
- the module name.public java.lang.String getModule()
getJar()
,
getClassname()
public Path createClasspath(Project p)
p
- the project to use to create the path.public Path createBootclasspath(Project p)
p
- the project to use to create the path.public Path createModulepath(Project p)
p
- the project to use to create the path.public Path createUpgrademodulepath(Project p)
p
- the project to use to create the path.public java.lang.String getVmversion()
public java.lang.String[] getCommandline()
public void setMaxmemory(java.lang.String max)
max
- the string to pass to the jvm to specify the max memory.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String describeCommand()
Runtime.exec(String[])
.public java.lang.String describeJavaCommand()
The class name is the executable in this context.
protected Commandline getActualVMCommand()
@Deprecated public int size()
getCommandline()
public Commandline getJavaCommand()
public Commandline getVmCommand()
public Path getClasspath()
public Path getBootclasspath()
public Path getModulepath()
public Path getUpgrademodulepath()
public void setSystemProperties() throws BuildException
BuildException
- if Security prevented this operation.public void restoreSystemProperties() throws BuildException
BuildException
- if Security prevented this operation, or
there was no system properties to restorepublic CommandlineJava.SysProperties getSystemProperties()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
BuildException
- if anything went wrong.java.lang.CloneNotSupportedException
- never.public void clearJavaArgs()
public boolean haveClasspath()
protected boolean haveBootclasspath(boolean log)
log
- whether to log a warning if a bootclasspath has been
specified but will be ignored.public boolean haveModulepath()
public boolean haveUpgrademodulepath()