|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.arakhne.vmutil.VMCommandLine
public class VMCommandLine
This utility class permits to get the java command line for the current VM.
| Constructor Summary | |
|---|---|
VMCommandLine()
Create a interface to the command line options. |
|
VMCommandLine(Class<?> classToLaunch,
String... parameters)
Create a interface to the command line options. |
|
VMCommandLine(Class<?> classToLaunch,
String[] optionDefinitions,
String... parameters)
Create a interface to the command line options. |
|
VMCommandLine(String classToLaunch,
String... parameters)
Create a interface to the command line options. |
|
VMCommandLine(String classToLaunch,
String[] optionDefinitions,
String... parameters)
Create a interface to the command line options. |
|
| Method Summary | |
|---|---|
static String[] |
getAllCommandLineParameters()
Replies the command line including the options and the standard parameters. |
static List<Object> |
getCommandLineOption(String name)
Replies one command option. |
static Map<String,List<Object>> |
getCommandLineOptions()
Replies the command line options. |
static String[] |
getCommandLineParameters()
Replies the command line parameters. |
static String |
getExecutableFilename(String name)
Replies a binary executable filename depending of the current platform. |
Object |
getFirstOptionValue(String optionLabel)
Replies the first value of the option. |
List<Object> |
getOptionValues(String optionLabel)
Replies the values of the option. |
String |
getParameterAt(int index)
Replies the parameter at the specified index. |
int |
getParameterCount()
Replies the count of parameters on the command line that are not options. |
String[] |
getParameters()
Replies the parameters on the command line that are not options. |
static String |
getVMBinary()
Replies the current java VM binary. |
static boolean |
hasCommandLineOption(String name)
Replies if an option was specified on the command line. |
boolean |
hasOption(String optionLabel)
Replies if the given option is present on the command line. |
boolean |
isParameterExists(int index)
Replies if the given index corresponds to a command line parameter. |
static Process |
launchVM(Class<?> classToLaunch,
String... additionalParams)
Run a new VM with the class path of the current VM. |
static Process |
launchVM(String classToLaunch,
String... additionalParams)
Run a new VM with the class path of the current VM. |
static Process |
launchVMWithClassPath(Class<?> classToLaunch,
File[] classpath,
String... additionalParams)
Run a new VM with the given class path. |
static Process |
launchVMWithClassPath(Class<?> classToLaunch,
String classpath,
String... additionalParams)
Run a new VM with the given class path. |
static Process |
launchVMWithClassPath(String classToLaunch,
File[] classpath,
String... additionalParams)
Run a new VM with the given class path. |
static Process |
launchVMWithClassPath(String classToLaunch,
String classpath,
String... additionalParams)
Run a new VM with the given class path. |
static Process |
launchVMWithJar(File jarFile,
String... additionalParams)
Run a jar file inside a new VM. |
static Process |
relaunchVM()
Launch a VM with the same parameters as ones saved by saveVMParameters(Class, String[]). |
static void |
saveVMParameters(Class<?> classToLaunch,
String... parameters)
Save parameters that permit to relaunch a VM with relaunchVM(). |
static void |
saveVMParameters(String classToLaunch,
String... parameters)
Save parameters that permit to relaunch a VM with relaunchVM(). |
static void |
saveVMParametersIfNotSet(Class<?> classToLaunch,
String... parameters)
Save parameters that permit to relaunch a VM with relaunchVM(). |
static void |
saveVMParametersIfNotSet(String classToLaunch,
String... parameters)
Save parameters that permit to relaunch a VM with relaunchVM(). |
static String |
shiftCommandLineParameters()
Shift the command line parameters by one on the left. |
String |
shiftParameters()
Shift the command line parameters by one on the left. |
static void |
splitOptionsAndParameters(String... optionDefinitions)
Analyse the command line to extract the options. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VMCommandLine(Class<?> classToLaunch,
String... parameters)
classToLaunch - is the class which contains a main.parameters - is the parameters to pass to the main.saveVMParametersIfNotSet(Class, String[])
public VMCommandLine(String classToLaunch,
String... parameters)
classToLaunch - is the class which contains a main.parameters - is the parameters to pass to the main.saveVMParametersIfNotSet(String, String[])
public VMCommandLine(Class<?> classToLaunch,
String[] optionDefinitions,
String... parameters)
classToLaunch - is the class which contains a main.optionDefinitions - is the list of definitions of the available command line options.parameters - is the parameters to pass to the main.saveVMParametersIfNotSet(Class, String[]),
splitOptionsAndParameters(String[])
public VMCommandLine(String classToLaunch,
String[] optionDefinitions,
String... parameters)
classToLaunch - is the class which contains a main.optionDefinitions - is the list of definitions of the available command line options.parameters - is the parameters to pass to the main.saveVMParametersIfNotSet(String, String[]),
splitOptionsAndParameters(String[])public VMCommandLine()
VMCommandLine(Class, String[], String[]),
VMCommandLine(Class, String[])| Method Detail |
|---|
public static String getExecutableFilename(String name)
name - is the name which must be converted into a binary executable filename.
public static String getVMBinary()
public static Process launchVMWithClassPath(Class<?> classToLaunch,
String classpath,
String... additionalParams)
throws IOException
classToLaunch - is the class to launch.classpath - is the class path to use.additionalParams - is the list of additional parameters
null
IOException
public static Process launchVMWithClassPath(String classToLaunch,
String classpath,
String... additionalParams)
throws IOException
classToLaunch - is the class to launch.classpath - is the class path to use.additionalParams - is the list of additional parameters
null
IOException
public static Process launchVMWithClassPath(Class<?> classToLaunch,
File[] classpath,
String... additionalParams)
throws IOException
classToLaunch - is the class to launch.classpath - is the class path to use.additionalParams - is the list of additional parameters
null
IOException
public static Process launchVMWithClassPath(String classToLaunch,
File[] classpath,
String... additionalParams)
throws IOException
classToLaunch - is the class to launch.classpath - is the class path to use.additionalParams - is the list of additional parameters
null
IOException
public static Process launchVMWithJar(File jarFile,
String... additionalParams)
throws IOException
jarFile - is the jar file to launch.additionalParams - is the list of additional parameters
null
IOException
public static Process launchVM(Class<?> classToLaunch,
String... additionalParams)
throws IOException
classToLaunch - is the class to launch.additionalParams - is the list of additional parameters
null
IOException
public static Process launchVM(String classToLaunch,
String... additionalParams)
throws IOException
classToLaunch - is the class to launch.additionalParams - is the list of additional parameters
null
IOException
public static void saveVMParameters(Class<?> classToLaunch,
String... parameters)
relaunchVM().
classToLaunch - is the class which contains a main.parameters - is the parameters to pass to the main.
public static void saveVMParameters(String classToLaunch,
String... parameters)
relaunchVM().
classToLaunch - is the class which contains a main.parameters - is the parameters to pass to the main.
public static void saveVMParametersIfNotSet(Class<?> classToLaunch,
String... parameters)
relaunchVM().
classToLaunch - is the class which contains a main.parameters - is the parameters to pass to the main.
public static void saveVMParametersIfNotSet(String classToLaunch,
String... parameters)
relaunchVM().
classToLaunch - is the class which contains a main.parameters - is the parameters to pass to the main.
public static Process relaunchVM()
throws IOException
saveVMParameters(Class, String[]).
null
IOExceptionpublic static String[] getAllCommandLineParameters()
public static String[] getCommandLineParameters()
public static String shiftCommandLineParameters()
nullpublic static Map<String,List<Object>> getCommandLineOptions()
public static List<Object> getCommandLineOption(String name)
name - is the name of the option
null if the option is not on the command line.public static boolean hasCommandLineOption(String name)
name - is the name of the option
true if the option was found on the command line, otherwise false.public static void splitOptionsAndParameters(String... optionDefinitions)
The options will be recognized thanks to the optionDefinitions. Each entry of optionDefinitions describes an option. They must have one of the following formats:
name: a simple option without value or flag,name=s: an option with a mandatory string value,name:s: an option with an optional string value,name=i: an option with a mandatory integer value,name:i: an option with an optional integer value,name=f: an option with a mandatory floating-point value,name:f: an option with an optional floating-point value,name=b: an option with a mandatory boolean value,name:b: an option with an optional boolean value,name+: an option with an autoincremented integer value,name!: an option which could be flaged or not: --name or --noname.
optionDefinitions - is the list of definitions of the available command line options.public boolean hasOption(String optionLabel)
optionLabel - is the name of the option
true if the option is present, otherwise falsepublic Object getFirstOptionValue(String optionLabel)
optionLabel - is the name of the option
null if the option is not present or has no value.public List<Object> getOptionValues(String optionLabel)
optionLabel - is the name of the option
null if the option is not present.public String[] getParameters()
public String shiftParameters()
nullpublic int getParameterCount()
public String getParameterAt(int index)
index -
IndexOutOfBoundsExceptionpublic boolean isParameterExists(int index)
index -
true if the given index corresponds to a parameter,
otherwise false
IndexOutOfBoundsException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||