org.rhq.core.pluginapi.util
Class JavaCommandLine
java.lang.Object
org.rhq.core.pluginapi.util.JavaCommandLine
public class JavaCommandLine
- extends Object
Parses a java command line and provides easy access to its parts.
A Java command line looks like this:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
Constructor Summary |
JavaCommandLine(String... args)
Same as JavaCommandLine(args, false, OptionFormat.POSIX, OptionFormat.POSIX) |
JavaCommandLine(String[] args,
boolean includeSystemPropertiesFromClassArguments)
Same as JavaCommandLine(args, includeSystemPropertiesFromClassArguments, OptionFormat.POSIX, OptionFormat.POSIX) |
JavaCommandLine(String[] args,
boolean includeSystemPropertiesFromClassArguments,
Set<JavaCommandLine.OptionValueDelimiter> shortClassOptionValueDelims,
Set<JavaCommandLine.OptionValueDelimiter> longClassOptionValueDelims)
|
JavaCommandLine
public JavaCommandLine(String... args)
- Same as
JavaCommandLine(args, false, OptionFormat.POSIX, OptionFormat.POSIX)
JavaCommandLine
public JavaCommandLine(String[] args,
boolean includeSystemPropertiesFromClassArguments)
- Same as
JavaCommandLine(args, includeSystemPropertiesFromClassArguments, OptionFormat.POSIX, OptionFormat.POSIX)
JavaCommandLine
public JavaCommandLine(String[] args,
boolean includeSystemPropertiesFromClassArguments,
Set<JavaCommandLine.OptionValueDelimiter> shortClassOptionValueDelims,
Set<JavaCommandLine.OptionValueDelimiter> longClassOptionValueDelims)
processClassArgument
protected void processClassArgument(String classArg,
String nextArg)
getArguments
@NotNull
public List<String> getArguments()
getJavaExecutable
@NotNull
public File getJavaExecutable()
getClassPath
@NotNull
public List<String> getClassPath()
getSystemProperties
@NotNull
public Map<String,String> getSystemProperties()
getJavaOptions
@NotNull
public List<String> getJavaOptions()
getMainClassName
@Nullable
public String getMainClassName()
getExecutableJarFile
@Nullable
public File getExecutableJarFile()
getClassArguments
@NotNull
public List<String> getClassArguments()
getClassOption
@Nullable
public String getClassOption(CommandLineOption option)
- Parameters:
option
- the class option to look for
- Returns:
- null if the class option is not on the command line, "" if it is on the command line and
either has no value or expects no value, and otherwise the non-empty value.
getClassOption
@Nullable
public String getClassOption(CommandLineOption option,
String defaultValue)
- Parameters:
option
- the class option to look fordefaultValue
- the value to return if the specified class option is not on the command line
- Returns:
- null if the class option is not on the command line, "" if it is on the command line and
either has no value or expects no value, and otherwise the non-empty value.
isClassOptionPresent
public boolean isClassOptionPresent(CommandLineOption option)
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.