Class BatchCompiler
java.lang.Object
org.eclipse.jdt.core.compiler.batch.BatchCompiler
A public API for invoking the Eclipse Compiler for Java. E.g.
BatchCompiler.compile("C:\\mySources\\X.java -d C:\\myOutput", new PrintWriter(System.out), new PrintWriter(System.err), null);
- Since:
- 3.4
- Restriction:
- This class is not intended to be instantiated by clients.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
compile
(String[] commandLineArguments, PrintWriter outWriter, PrintWriter errWriter, CompilationProgress progress) Invokes the Eclipse Compiler for Java with the given command line arguments, using the given writers to print messages, and reporting progress to the given compilation progress.static boolean
compile
(String commandLine, PrintWriter outWriter, PrintWriter errWriter, CompilationProgress progress) Invokes the Eclipse Compiler for Java with the given command line arguments, using the given writers to print messages, and reporting progress to the given compilation progress.
-
Method Details
-
compile
public static boolean compile(String commandLine, PrintWriter outWriter, PrintWriter errWriter, CompilationProgress progress) Invokes the Eclipse Compiler for Java with the given command line arguments, using the given writers to print messages, and reporting progress to the given compilation progress. Returns whether the compilation completed successfully.Reasons for a compilation failing to complete successfully include:
- an error was reported
- a runtime exception occurred
- the compilation was canceled using the compilation progress
The specification of the command line arguments is defined by running the batch compiler's help
BatchCompiler.compile("-help", new PrintWriter(System.out), new PrintWriter(System.err), null);
- Parameters:
commandLine
- the command line arguments passed to the compileroutWriter
- the writer used to print standard messageserrWriter
- the writer used to print error messagesprogress
- the object to report progress to and to provide cancellation, ornull
if no progress is needed- Returns:
- whether the compilation completed successfully
-
compile
public static boolean compile(String[] commandLineArguments, PrintWriter outWriter, PrintWriter errWriter, CompilationProgress progress) Invokes the Eclipse Compiler for Java with the given command line arguments, using the given writers to print messages, and reporting progress to the given compilation progress. Returns whether the compilation completed successfully.Reasons for a compilation failing to complete successfully include:
- an error was reported
- a runtime exception occurred
- the compilation was canceled using the compilation progress
The specification of the command line arguments is defined by running the batch compiler's help
BatchCompiler.compile("-help", new PrintWriter(System.out), new PrintWriter(System.err), null);
Note that a
true
returned value indicates that no errors were reported, no runtime exceptions occurred and that the compilation was not canceled.- Parameters:
commandLineArguments
- the command line arguments passed to the compileroutWriter
- the writer used to print standard messageserrWriter
- the writer used to print error messagesprogress
- the object to report progress to and to provide cancellation, ornull
if no progress is needed- Returns:
- whether the compilation completed successfully
-