public final class JavaRunner extends Object
Class that allows to execute given file(s). API clients can check whether given
command is support, by calling
JavaRunner.isSupported(String, Map)
and execute the command by calling
JavaRunner.execute(String, Map)
. Please consult documentation of particular
commands for the list of supported properties.
JavaRunner.PROP_EXECUTE_FILE | file to be executed (optional) | String (absolute path) or FileObject |
JavaRunner.PROP_WORK_DIR | working directory, project directory of execute.file will be used if missing | String or FileObject or File |
JavaRunner.PROP_CLASSNAME | class to execute, will be autodetected from execute.file if missing | String |
JavaRunner.PROP_EXECUTE_CLASSPATH | execute classpath, will be autodetected from execute.file if missing | ClassPath |
JavaRunner.PROP_PLATFORM_JAVA | java tool which should be used for execution, will be autodetected from platform property if missing | String or FileObject or File |
JavaRunner.PROP_PLATFORM | java platform on which the class should be executed, default if missing, not needed if platform.java is set | JavaPlatform |
JavaRunner.PROP_PROJECT_NAME | name of the current project, will be autodetected from execute.file if missing | String |
JavaRunner.PROP_RUN_JVMARGS | JVM arguments | Iterable of String s |
JavaRunner.PROP_APPLICATION_ARGS | application arguments | Iterable of String s |
JavaRunnerImplementation
Modifier and Type | Field and Description |
---|---|
static String |
PROP_APPLICATION_ARGS
Application arguments to be used for the execution.
|
static String |
PROP_CLASSNAME
The name of the class to execute.
|
static String |
PROP_EXECUTE_CLASSPATH
Execute classpath to use for execution of the class.
|
static String |
PROP_EXECUTE_FILE
File to execute.
|
static String |
PROP_EXECUTE_MODULEPATH
Execute modulepath to use for execution of the class.
|
static String |
PROP_PLATFORM
Java platform to use for execution.
|
static String |
PROP_PLATFORM_JAVA
Java tool to use for execution.
|
static String |
PROP_PROJECT_NAME
Project name to use for Output Window caption.
|
static String |
PROP_RUN_JVMARGS
JVM arguments to be used for the execution.
|
static String |
PROP_RUNTIME_ENCODING
Runtime file encoding passed to the jvm (-Dfile.encoding).
|
static String |
PROP_WORK_DIR
Working directory for execution.
|
static String |
QUICK_CLEAN
Clean classfiles produced by the Java infrastructure.
|
static String |
QUICK_DEBUG
"Test" run the given file in the debugging mode.
|
static String |
QUICK_DEBUG_APPLET
"Test" run the given applet in debugging mode.
|
static String |
QUICK_PROFILE
"Test" run the given file in the profiling mode.
|
static String |
QUICK_PROFILE_APPLET
"Test" run the given applet in the profiling mode.
|
static String |
QUICK_RUN
"Test" run the given file.
|
static String |
QUICK_RUN_APPLET
"Test" run the given applet.
|
static String |
QUICK_TEST
"Test" run the given test.
|
static String |
QUICK_TEST_DEBUG
"Test" run the given test in the debugging mode.
|
static String |
QUICK_TEST_PROFILE
"Test" run the given test in the profiling mode.
|
Constructor and Description |
---|
JavaRunner() |
Modifier and Type | Method and Description |
---|---|
static ExecutorTask |
execute(String command,
Map<String,?> properties)
Execute the given command with given parameters.
|
static boolean |
isSupported(String command,
Map<String,?> properties)
Check whether the given command is supported.
|
public static final String QUICK_RUN
"Test" run the given file. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_CLASSNAME
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
, JavaRunner.PROP_RUN_JVMARGS
and JavaRunner.PROP_APPLICATION_ARGS
.
public static final String QUICK_DEBUG
"Test" run the given file in the debugging mode. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_CLASSNAME
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
, JavaRunner.PROP_RUN_JVMARGS
and JavaRunner.PROP_APPLICATION_ARGS
.
Property stopclassname
can be set to a classname to support starting debugger using
the Step Into command.
public static final String QUICK_PROFILE
"Test" run the given file in the profiling mode. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_CLASSNAME
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
, JavaRunner.PROP_RUN_JVMARGS
and JavaRunner.PROP_APPLICATION_ARGS
.
public static final String QUICK_TEST
"Test" run the given test. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_CLASSNAME
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
and JavaRunner.PROP_RUN_JVMARGS
.
application.args property is not supported.
public static final String QUICK_TEST_DEBUG
"Test" run the given test in the debugging mode. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_CLASSNAME
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
and JavaRunner.PROP_RUN_JVMARGS
.
public static final String QUICK_TEST_PROFILE
"Test" run the given test in the profiling mode. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_CLASSNAME
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
and JavaRunner.PROP_RUN_JVMARGS
.
application.args property is not supported.
public static final String QUICK_RUN_APPLET
"Test" run the given applet. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_EXECUTE_FILE
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
and JavaRunner.PROP_RUN_JVMARGS
,
applet.url
.
public static final String QUICK_DEBUG_APPLET
"Test" run the given applet in debugging mode. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_EXECUTE_FILE
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
and JavaRunner.PROP_RUN_JVMARGS
,
applet.url
.
public static final String QUICK_PROFILE_APPLET
"Test" run the given applet in the profiling mode. Classfiles produced by the Java infrastructure will be executed.
These properties are should be set in the properties, or inferable: JavaRunner.PROP_EXECUTE_CLASSPATH
,
JavaRunner.PROP_EXECUTE_FILE
, JavaRunner.PROP_PLATFORM_JAVA
, JavaRunner.PROP_WORK_DIR
and JavaRunner.PROP_RUN_JVMARGS
,
applet.url
.
public static final String QUICK_CLEAN
public static final String PROP_EXECUTE_FILE
String
(absolute path) or FileObject
.public static final String PROP_WORK_DIR
public static final String PROP_RUN_JVMARGS
Iterable
of String
s.
Arguments may also be contributed by StartupExtenders;
the JavaPlatform
(see JavaRunner.PROP_PLATFORM
) will be in the context,
as will a Project
if available from JavaRunner.PROP_EXECUTE_FILE
or JavaRunner.PROP_WORK_DIR
.
public static final String PROP_CLASSNAME
String
- fully qualified binary name.
Will be autodetected from JavaRunner.PROP_EXECUTE_FILE
if missing.public static final String PROP_EXECUTE_CLASSPATH
ClassPath
.
Will be autodetected from JavaRunner.PROP_EXECUTE_FILE
if missing.public static final String PROP_EXECUTE_MODULEPATH
ClassPath
.
Will be autodetected from JavaRunner.PROP_EXECUTE_FILE
if missing.public static final String PROP_PLATFORM_JAVA
String
(absolute path) or FileObject
or File
.
Will be autodetected from JavaRunner.PROP_PLATFORM
if missing.public static final String PROP_PLATFORM
JavaPlatform
.
Will be used to autodetect JavaRunner.PROP_PLATFORM_JAVA
.public static final String PROP_PROJECT_NAME
String
.
Will be autodetected from JavaRunner.PROP_EXECUTE_FILE
if missing.public static final String PROP_APPLICATION_ARGS
public static final String PROP_RUNTIME_ENCODING
FileEncodingQuery
is used
to obtain the encoding.public static boolean isSupported(String command, Map<String,?> properties)
command
- command nameproperties
- propertiespublic static ExecutorTask execute(String command, Map<String,?> properties) throws IOException, UnsupportedOperationException
command
- command to executeproperties
- propertiesIOException
- if execution failsUnsupportedOperationException
- if the given command is not supported