public final class JkJavaProcess
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
JkJavaProcess |
andAgent(java.nio.file.Path agentLib)
Returns a
JkJavaProcess identical to this one but augnmented with the
specified agent library. |
JkJavaProcess |
andAgent(java.nio.file.Path agentLib,
java.lang.String agentOption)
Returns a
JkJavaProcess identical to this one but augmented with the
specified agent library and option. |
JkJavaProcess |
andClasspath(JkClasspath classpath)
Returns a
JkJavaProcess identical to this one but augmenting this
classpath with the specified one. |
JkJavaProcess |
andCommandLine(java.lang.String commandLine)
Takes the specified command line as is and add it to the process command
line.
|
JkJavaProcess |
andOptions(java.util.Collection<java.lang.String> options)
Returns a
JkJavaProcess identical to this one but with the
specified java options. |
JkJavaProcess |
andOptions(java.lang.String... options)
Same as
andOptions(Collection) . |
JkJavaProcess |
andOptionsIf(boolean condition,
java.lang.String... options)
Same as
andOptions(Collection) but effective only if the specified condition
is true . |
JkClasspath |
getClasspath()
Returns the classpth of this
JkJavaProcess . |
static JkJavaProcess |
of()
Initializes a
JkJavaProcess using the same JRE then the one
currently running. |
static JkJavaProcess |
ofJavaHome(java.nio.file.Path javaDir)
Initializes a
JkJavaProcess using the Java executable
located in the specified directory. |
void |
runClassSync(java.lang.String mainClassName,
java.lang.String... arguments)
Runs the specified class and wait for termination.
|
void |
runJarSync(java.nio.file.Path jar,
java.lang.String... arguments) |
JkJavaProcess |
withClasspath(java.lang.Iterable<java.nio.file.Path> paths)
Returns a
JkJavaProcess identical to this one but using the specified
classpath. |
JkJavaProcess |
withClasspath(java.nio.file.Path path1,
java.nio.file.Path path2,
java.nio.file.Path... others)
Returns a
JkJavaProcess identical to this one but using the specified
classpath. |
JkJavaProcess |
withWorkingDir(java.nio.file.Path workingDir)
Returns a
JkJavaProcess identical to this one but using the specified
working dir. |
public static JkJavaProcess of()
JkJavaProcess
using the same JRE then the one
currently running.public static JkJavaProcess ofJavaHome(java.nio.file.Path javaDir)
JkJavaProcess
using the Java executable
located in the specified directory.public JkJavaProcess andAgent(java.nio.file.Path agentLib, java.lang.String agentOption)
JkJavaProcess
identical to this one but augmented with the
specified agent library and option.public JkJavaProcess andAgent(java.nio.file.Path agentLib)
JkJavaProcess
identical to this one but augnmented with the
specified agent library.public JkJavaProcess andOptions(java.util.Collection<java.lang.String> options)
JkJavaProcess
identical to this one but with the
specified java options.public JkJavaProcess andOptionsIf(boolean condition, java.lang.String... options)
andOptions(Collection)
but effective only if the specified condition
is true
.public JkJavaProcess andOptions(java.lang.String... options)
andOptions(Collection)
.public JkJavaProcess andCommandLine(java.lang.String commandLine)
public JkJavaProcess withWorkingDir(java.nio.file.Path workingDir)
JkJavaProcess
identical to this one but using the specified
working dir.public JkJavaProcess withClasspath(java.lang.Iterable<java.nio.file.Path> paths)
JkJavaProcess
identical to this one but using the specified
classpath.paths
- As Path
class implements Iterable
the argument can be a single Path
instance, if so it will be interpreted as a list containing a single element which is this argument.public JkJavaProcess withClasspath(java.nio.file.Path path1, java.nio.file.Path path2, java.nio.file.Path... others)
JkJavaProcess
identical to this one but using the specified
classpath.public JkJavaProcess andClasspath(JkClasspath classpath)
JkJavaProcess
identical to this one but augmenting this
classpath with the specified one.public void runJarSync(java.nio.file.Path jar, java.lang.String... arguments)
public void runClassSync(java.lang.String mainClassName, java.lang.String... arguments)
public JkClasspath getClasspath()
JkJavaProcess
.