public abstract class Launcher extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Launcher.AbortException |
protected static class |
Launcher.VersionAction |
static class |
Launcher.VMType |
Modifier and Type | Method and Description |
---|---|
protected Launcher.AbortException |
abort(IOException e)
Exits the launcher, indicating failure because of the provided
IOException . |
protected Launcher.AbortException |
abort(IOException e,
int exitCode)
Exits the launcher with the provided exit code because of the provided
IOException . |
protected Launcher.AbortException |
abort(String message)
Exits the launcher, indicating failure.
|
protected Launcher.AbortException |
abort(String message,
int exitCode)
Exits the launcher, with the provided exit code.
|
protected Launcher.AbortException |
abort(Throwable t)
Exits the launcher, indicating failure because of the provided
Throwable . |
protected Launcher.AbortException |
abort(Throwable t,
int exitCode)
Exits the launcher with the provided exit code because of the provided
Throwable . |
protected Launcher.AbortException |
abortInvalidArgument(String argument,
String message)
Exits the launcher, indicating failure because of an invalid argument.
|
protected Launcher.AbortException |
abortInvalidArgument(String argument,
String message,
int exitCode)
Exits the launcher with the provided exit code because of an invalid argument.
|
protected abstract void |
collectArguments(Set<String> options)
Add all known arguments to the
options list. |
protected Launcher.AbortException |
exit()
Exits the launcher, indicating success.
|
protected Launcher.AbortException |
exit(int exitCode)
Exits the launcher with the provided exit code.
|
protected Launcher.VMType |
getDefaultVMType()
The return value specifies the default VM when none of --jvm, --native options is used.
|
protected String |
getMainClass()
Returns the name of the main class for this launcher.
|
protected static boolean |
isAOT()
Returns true if the current launcher was compiled ahead-of-time to native code.
|
protected abstract void |
printHelp(org.graalvm.options.OptionCategory maxCategory)
Prints a help message to stdout.
|
protected static void |
printPolyglotVersions()
Prints version information about all known languages and
instruments on stdout.
|
protected abstract void |
printVersion()
Prints version information on stdout.
|
protected void |
setVersionAction(Launcher.VersionAction versionAction)
Sets the version action that will be executed before launching.
|
protected void setVersionAction(Launcher.VersionAction versionAction)
protected final Launcher.AbortException exit()
Launcher.AbortException
.protected final Launcher.AbortException exit(int exitCode)
Launcher.AbortException
.exitCode
- the exit code of the launcher process.protected final Launcher.AbortException abort(String message)
Launcher.AbortException
.message
- an error message that will be printed to stderr. If
null, nothing will be printed.protected final Launcher.AbortException abort(String message, int exitCode)
Launcher.AbortException
.message
- an error message that will be printed to stderr. If
null, nothing will be printed.exitCode
- the exit code of the launcher process.protected final Launcher.AbortException abort(Throwable t)
Throwable
.
This aborts by throwing an Launcher.AbortException
.t
- the exception that causes the launcher to abort.protected final Launcher.AbortException abort(Throwable t, int exitCode)
Throwable
.
This aborts by throwing an Launcher.AbortException
.t
- the exception that causes the launcher to abort.exitCode
- the exit code of the launcher process.protected final Launcher.AbortException abort(IOException e)
IOException
.
This tries to build a helpful error message based on exception.
This aborts by throwing an Launcher.AbortException
.e
- the exception that causes the launcher to abort.protected final Launcher.AbortException abort(IOException e, int exitCode)
IOException
.
This tries to build a helpful error message based on exception.
This aborts by throwing an Launcher.AbortException
.e
- the exception that causes the launcher to abort.exitCode
- the exit code of the launcher processprotected final Launcher.AbortException abortInvalidArgument(String argument, String message)
Launcher.AbortException
.argument
- the problematic argument.message
- an error message that is printed to stderr.protected final Launcher.AbortException abortInvalidArgument(String argument, String message, int exitCode)
Launcher.AbortException
.argument
- the problematic argument.message
- an error message that is printed to stderr.exitCode
- the exit code of the launcher process.protected abstract void printHelp(org.graalvm.options.OptionCategory maxCategory)
maxCategory or less
.maxCategory
- the maximum category of options that should be printed.protected abstract void printVersion()
protected abstract void collectArguments(Set<String> options)
options
list.options
- list to which valid arguments must be added.protected static void printPolyglotVersions()
protected String getMainClass()
return MyLauncher.class.getName();
protected Launcher.VMType getDefaultVMType()
protected static boolean isAOT()