Interface JavaForkOptions
- All Superinterfaces:
ProcessForkOptions
- All Known Subinterfaces:
JavaExecSpec
- All Known Implementing Classes:
JavaExec, RhinoShellExec, Test
Specifies the options to use to fork a Java process.
-
Method Summary
Modifier and TypeMethodDescriptionbootstrapClasspath(Object... classpath) Adds the given values to the end of the bootstrap classpath for the process.copyTo(JavaForkOptions options) Copies these options to the given options.Returns the full set of arguments to use to launch the JVM for the process.Returns the bootstrap classpath to use for the process.booleangetDebug()Returns true if debugging is enabled for the process.Returns the default character encoding to use.booleanReturns true if assertions are enabled for the process.Returns the extra arguments to use to launch the JVM for the process.Returns the maximum heap size for the process, if any.Returns the minimum heap size for the process, if any.Returns the system properties which will be used for the process.Adds some arguments to use to launch the JVM for the process.Adds some arguments to use to launch the JVM for the process.voidsetAllJvmArgs(Iterable<?> arguments) Sets the full set of arguments to use to launch the JVM for the process.voidsetAllJvmArgs(List<String> arguments) Sets the full set of arguments to use to launch the JVM for the process.voidsetBootstrapClasspath(FileCollection classpath) Sets the bootstrap classpath to use for the process.voidsetDebug(boolean enabled) Enable or disable debugging for the process.voidsetDefaultCharacterEncoding(String defaultCharacterEncoding) Sets the default character encoding to use.voidsetEnableAssertions(boolean enabled) Enable or disable assertions for the process.voidsetJvmArgs(Iterable<?> arguments) Sets the extra arguments to use to launch the JVM for the process.voidsetJvmArgs(List<String> arguments) Sets the extra arguments to use to launch the JVM for the process.voidsetMaxHeapSize(String heapSize) Sets the maximum heap size for the process.voidsetMinHeapSize(String heapSize) Sets the minimum heap size for the process.voidsetSystemProperties(Map<String, ?> properties) Sets the system properties to use for the process.systemProperties(Map<String, ?> properties) Adds some system properties to use for the process.systemProperty(String name, Object value) Adds a system property to use for the process.Methods inherited from interface ProcessForkOptions
copyTo, environment, environment, executable, getEnvironment, getExecutable, getWorkingDir, setEnvironment, setExecutable, setExecutable, setWorkingDir, setWorkingDir, workingDir
-
Method Details
-
getSystemProperties
-
setSystemProperties
-
systemProperties
Adds some system properties to use for the process.- Parameters:
properties- The system properties. Must not be null.- Returns:
- this
-
systemProperty
Adds a system property to use for the process.- Parameters:
name- The name of the propertyvalue- The value for the property. May be null.- Returns:
- this
-
getDefaultCharacterEncoding
Returns the default character encoding to use.- Returns:
- The default character encoding. Returns null if the
default character encoding of this JVMshould be used.
-
setDefaultCharacterEncoding
Sets the default character encoding to use. Note: Many JVM implementations support the setting of this attribute via system property on startup (namely, thefile.encodingproperty). For JVMs where this is the case, setting thefile.encodingproperty viasetSystemProperties(java.util.Map)or similar will have no effect as this value will be overridden by the value specified bygetDefaultCharacterEncoding().- Parameters:
defaultCharacterEncoding- The default character encoding. Use null to usethis JVM's default charset
-
getMinHeapSize
-
setMinHeapSize
Sets the minimum heap size for the process.- Parameters:
heapSize- The minimum heap size. Use null for the default minimum heap size.
-
getMaxHeapSize
-
setMaxHeapSize
Sets the maximum heap size for the process.- Parameters:
heapSize- The heap size. Use null for the default maximum heap size.
-
getJvmArgs
-
setJvmArgs
-
setJvmArgs
Sets the extra arguments to use to launch the JVM for the process. System properties and minimum/maximum heap size are updated.- Parameters:
arguments- The arguments. Must not be null.
-
jvmArgs
Adds some arguments to use to launch the JVM for the process.- Parameters:
arguments- The arguments. Must not be null.- Returns:
- this
-
jvmArgs
Adds some arguments to use to launch the JVM for the process.- Parameters:
arguments- The arguments.- Returns:
- this
-
getBootstrapClasspath
Returns the bootstrap classpath to use for the process. The default bootstrap classpath for the JVM is used when this classpath is empty.- Returns:
- The bootstrap classpath. Never returns null.
-
setBootstrapClasspath
Sets the bootstrap classpath to use for the process. Set to an empty classpath to use the default bootstrap classpath for the specified JVM.- Parameters:
classpath- The classpath. Must not be null. Can be empty.
-
bootstrapClasspath
Adds the given values to the end of the bootstrap classpath for the process.- Parameters:
classpath- The classpath.- Returns:
- this
-
getEnableAssertions
Returns true if assertions are enabled for the process.- Returns:
- true if assertions are enabled, false if disabled
-
setEnableAssertions
void setEnableAssertions(boolean enabled) Enable or disable assertions for the process.- Parameters:
enabled- true to enable assertions, false to disable.
-
getDebug
Returns true if debugging is enabled for the process. When enabled, the process is started suspended and listening on port 5005.- Returns:
- true when debugging is enabled, false to disable.
-
setDebug
void setDebug(boolean enabled) Enable or disable debugging for the process. When enabled, the process is started suspended and listening on port 5005.- Parameters:
enabled- true to enable debugging, false to disable.
-
getAllJvmArgs
Returns the full set of arguments to use to launch the JVM for the process. This includes arguments to define system properties, the minimum/maximum heap size, and the bootstrap classpath.- Returns:
- The arguments. Returns an empty list if there are no arguments.
-
setAllJvmArgs
-
setAllJvmArgs
Sets the full set of arguments to use to launch the JVM for the process. Overwrites any previously set system properties, minimum/maximum heap size, assertions, and bootstrap classpath.- Parameters:
arguments- The arguments. Must not be null.
-
copyTo
Copies these options to the given options.- Parameters:
options- The target options.- Returns:
- this
-