public final class InteractiveShell
extends org.codehaus.commons.compiler.samples.DemoBase
| Modifier and Type | Method and Description |
|---|---|
static void |
run(String[] defaultImports,
Class<?>[] thrownExceptions,
String optionalEncoding)
Executes the ".jshrc" file, then reads statements from the console and executes them.
|
public static void run(String[] defaultImports, Class<?>[] thrownExceptions, @Nullable String optionalEncoding) throws IOException, org.codehaus.commons.compiler.CompileException, InvocationTargetException
Errors that occur as the ".jshrc" file is processed are not caught; errors that occur as statements are read from the console, scanned, parsed, compiled an executed are reported on the console in a user-friendly fashion, and otherwise ignored.
In addition to any "normal" Java statement, the following constructs are supported:
throws java.lang.Exception;") allows all statements that are entered
afterwards to throw that exception. (Notice that the Java language knows no "throws statement"; only the
InteractiveShell supports that concept.) There is no way to remove a previously declared exception.
The exception class name must be fully qualified.
defaultImports - These add to the sytem import "java.lang"; effective for the RC script and the
entered commandsthrownExceptions - The exceptions that the RC script and the entered commands may throwoptionalEncoding - Effective for the RC scriptInvocationTargetException - The RC script or an entered command threw one of the
thrownExceptionsorg.codehaus.commons.compiler.CompileException - An error occurred when the RC script was read, scanned, parsed and compiledIOExceptionCopyright © 2016. All rights reserved.