Class Main
- java.lang.Object
-
- org.mozilla.javascript.tools.shell.Main
-
public class Main extends Object
The shell program. Can execute scripts interactively or in batch mode at the command line. An example of controlling the JavaScript engine.
-
-
Field Summary
Fields Modifier and Type Field Description static Global
global
static ShellContextFactory
shellContextFactory
-
Constructor Summary
Constructors Constructor Description Main()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
exec(String[] origArgs)
Execute the given arguments, but don't System.exit at the end.static PrintStream
getErr()
static Global
getGlobal()
static InputStream
getIn()
static PrintStream
getOut()
static void
main(String[] args)
Main entry point.static void
processFile(Context cx, Scriptable scope, String filename)
static void
processFileNoThrow(Context cx, Scriptable scope, String filename)
static String[]
processOptions(String[] args)
Parse arguments.static void
processSource(Context cx, String filename)
Evaluate JavaScript source.static void
setErr(PrintStream err)
static void
setIn(InputStream in)
static void
setOut(PrintStream out)
-
-
-
Field Detail
-
shellContextFactory
public static ShellContextFactory shellContextFactory
-
global
public static Global global
-
-
Method Detail
-
main
public static void main(String[] args)
Main entry point. Process arguments as would a normal Java program. Also create a new Context and associate it with the current thread. Then set up the execution environment and begin to execute scripts.
-
exec
public static int exec(String[] origArgs)
Execute the given arguments, but don't System.exit at the end.
-
getGlobal
public static Global getGlobal()
-
processSource
public static void processSource(Context cx, String filename) throws IOException
Evaluate JavaScript source.- Parameters:
cx
- the current contextfilename
- the name of the file to compile, or null for interactive mode.- Throws:
IOException
- if the source could not be readRhinoException
- thrown during evaluation of source
-
processFileNoThrow
public static void processFileNoThrow(Context cx, Scriptable scope, String filename)
-
processFile
public static void processFile(Context cx, Scriptable scope, String filename) throws IOException
- Throws:
IOException
-
getIn
public static InputStream getIn()
-
setIn
public static void setIn(InputStream in)
-
getOut
public static PrintStream getOut()
-
setOut
public static void setOut(PrintStream out)
-
getErr
public static PrintStream getErr()
-
setErr
public static void setErr(PrintStream err)
-
-