public class JavaCompileCommand extends Command
public class COMPILER { public COMPILER(java.io.OutputStream out, String compilerName); public boolean compile(String[] args); }or
public class COMPILER { public COMPILER(); public int compile(String[] args); }or
public class COMPILER { public static int compile(String[] args, PrintWriter out); }This means the command is suitable for (but not limited to) the compiler javac suplied with JDK. (Note that this uses an internal API of javac which is not documented and is not guaranteed to exist in any specific release of JDK.)
Modifier and Type | Field and Description |
---|---|
static boolean |
defaultVerbose |
Constructor and Description |
---|
JavaCompileCommand() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
A stand-alone entry point for this command.
|
Status |
run(java.lang.String[] args,
java.io.PrintWriter log,
java.io.PrintWriter ref)
Invoke a specified compiler, or the default, javac.
|
getClassLoader, setClassLoader
public static void main(java.lang.String[] args)
run
method invoked,
passing in the command line args and System.out
and
System.err
as the two streams.args
- command line arguments for this command.run(java.lang.String[], java.io.PrintWriter, java.io.PrintWriter)
public Status run(java.lang.String[] args, java.io.PrintWriter log, java.io.PrintWriter ref)
args
array is "-compiler"
the second is interpreted as the class name for the compiler to be
invoked, optionally preceded by a name for the compiler, separated
from the class name by a colon. If no -compiler is specified,
the default is `javac:com.sun.tools.javac.Main'. If -compiler is specified
but no compiler name is given before the class name, the default name
will be `java ' followed by the classname. For example, `-compiler Main'
will result in the class name being `Main' and the compiler name being
`java Main'. After determining the class and compiler name,
an instance of the compiler class will be created, passing it a stream
using the ref
parameter, and the name of the compiler.
Then the `compile' method will be invoked, passing it the remaining
values of the `args' parameter. If the compile method returns true,
the result will be a status of `passed'; if it returns `false', the
result will be `failed'. If any problems arise, the result will be
a status of `error'.run
in class Command
args
- An optional specification for the compiler to be invoked,
followed by arguments for the compiler's compile method.log
- Not used.ref
- Passed to the compiler that is invoked.Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.