jdt-core-home/howto/batch compile/batchCompile.html
Parent Directory
|
Revision Log
Revision 1.2 -
(download)
(as text)
(annotate)
Fri Sep 6 20:09:26 2002 UTC (7 years, 2 months ago) by oliviert
Branch: MAIN
Changes since 1.1: +8 -4 lines
Fri Sep 6 20:09:26 2002 UTC (7 years, 2 months ago) by oliviert
Branch: MAIN
Changes since 1.1: +8 -4 lines
Updated options
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]"> <title>How to: Run batch compiler</title> <link rel="stylesheet" href="http://dev.eclipse.org/default_style.css" type="text/css"> </head> <body text="#000000" bgcolor="#FFFFFF"> <table BORDER=0 CELLSPACING=5 CELLPADDING=2 WIDTH="100%" > <tr> <td ALIGN=LEFT VALIGN=TOP COLSPAN="2" BGCOLOR="#0080C0"><b><font color="#FFFFFF">JDT Core / HowTo: Run the Batch Compiler </font></b></td> </tr> <tr> <td ALIGN=RIGHT VALIGN=TOP WIDTH="2%"><img SRC="http://dev.eclipse.org/images/Adarrow.gif" NOSAVE BORDER=0 height=16 width=16></td> <td WIDTH="98%"><b>Finding the batch compiler</b> <br>The batch compiler class is located in the internal classes of the JDT/Core plugin. So it is in the <i>jdtcore.jar</i> file in the directory <i>plugins/org.eclipse.jdt.core</i>. The name of the class is <i>org.eclipse.jdt.internal.compiler.batch.Main</i>. </td> </tr> <tr> <td ALIGN=RIGHT VALIGN=TOP WIDTH="2%"><img SRC="http://dev.eclipse.org/images/Adarrow.gif" NOSAVE BORDER=0 height=16 width=16></td> <td WIDTH="98%"><b>Running the batch compiler</b> <ul> <li> Using the main method.</li> <blockquote>Using the main method. The Main class has a main method. This is the classical way to invoke the batch compiler on a command-line. <ul> <li> For example on a command-line:</li> <br><font color="#3366FF">java -classpath jdtcore.jar org.eclipse.jdt.internal.compiler.batch.Main -classpath rt.jar A.java</font> <li> For example in a java source:</li> <br><font color="#3366FF">org.eclipse.jdt.internal.compiler.batch.Main.main(new String[] {"-classpath", "rt.jar", "A.java"});</font></ul> </blockquote> <li> Using the static compile(String) method.</li> <blockquote>The compile(String) method is a convenient method to invoke the batch compiler in a java application. <br>Instead of: <ul> <li> <font color="#3366FF">org.eclipse.jdt.internal.compiler.batch.Main.main(new String[] {"-classpath", "rt.jar", "A.java"});</font></li> <li> you can simply write: <font color="#3366FF">org.eclipse.jdt.internal.compiler.batch.Main.compile("-classpath rt.jar A.java");</font></li> </ul> </blockquote> </ul> </td> </tr> <tr> <td ALIGN=RIGHT VALIGN=TOP WIDTH="2%"><img SRC="http://dev.eclipse.org/images/Adarrow.gif" NOSAVE BORDER=0 height=16 width=16></td> <td WIDTH="98%"><b>Which options are available?</b> <p> With the orange background, these are suggested options. </p> <blockquote> <table BORDER CELLSPACING=2 CELLPADDING=2 COLS=2 WIDTH="100%" > <tr> <th>Name</th> <th>Usage</th> </tr> <tr> <td>-help</td> <td valign=top>Display the help message</td> </tr> <tr> <td valign=top>-version</td> <td>Display the build number of the compiler. This is very useful to report a bug.</td> </tr> <tr> <td valign=top bgcolor="#FFCCAA">-bootclasspath <dir 1>;<dir 2>;...;<dir P></td> <td valign=top bgcolor="#FFCCAA">This is a list of directory or jar files used to bootstrap the class files used by the compiler. By default the libraries of the running VM are used.</td> </tr> <tr> <td valign=top bgcolor="#FFCCAA">-classpath <dir 1>;<dir 2>;...;<dir P></td> <td valign=top bgcolor="#FFCCAA">This is a list of directory or jar files used to compile the source files. The default value is the value of the property "java.class.path". </td> </tr> <tr> <td valign=top bgcolor="#FFCCAA">-d <dir 1>|none</td> <td bgcolor="#FFCCAA">This is used to specify in which directory the generated .class files should be dumped. If it is omitted, no package directory structure is created.<br> If you don't want to generate .class files, use <font color="#3366FF">-d none</font>.</td> </tr> <tr> <td valign=top>-target 1.1|1.2</td> <td>This specifies the classfile target setting. The possible value are <font color="#3366FF">1.1</font> or <font color="#3366FF">1.2</font>, default is <font color="#3366FF">1.1</font></td> </tr> <tr> <td valign=top>-1.3</td> <td>Set compliance level to <font color="#3366FF">1.3</font> (default)</td> </tr> <tr> <td valign=top>-1.4</td> <td>Set compliance level to <font color="#3366FF">1.4</font>.</td> </tr> <tr> <td valign=top>-source 1.3|1.4</td> <td>This is used to enable the assertion support of the compiler. The possible value are: <font color="#3366FF">1.3</font> or <font color="#3366FF">1.4</font>, default is <font color="#3366FF">1.3</font> in <font color="#3366FF">-1.3</font> mode and <font color="#3366FF">1.4</font> in <font color="#3366FF">-1.4</font> mode. In <font color="#3366FF">1.4</font>, <font color="#3366FF"><I>assert</I></font> is treated as a keyword.</td> </tr> <tr> <td valign=top>-warn: <blockquote>constructorName<br>|packageDefaultMethod<br>|deprecation<br>|maskedCatchBlocks<br>|unusedLocals<br>|unusedArguments<br>|unusedImports<br>|syntheticAccess<br>|assertIdentifier</blockquote> </td> <td>Set warning level.<br>e.g. <font color="#3366FF">-warn:unusedLocals,deprecation</font><br> <table> <tr> <th align=left>constructorName</th> <td>warn method with constructor name</td> </tr> <tr> <th align=left>packageDefaultMethod</th> <td>warn attempt to override package-default method</td> </tr> <tr> <th align=left>deprecation</th> <td>warn usage of deprecated type or member</td> </tr> <tr> <th align=left>maskedCatchBlocks</th> <td>warn hidden catch block</td> </tr> <tr> <th align=left>unusedLocals</th> <td>warn unused local variable</td> </tr> <tr> <th align=left>unusedArguments</th> <td>warn unused method argument</td> </tr> <tr> <th align=left>unusedImports</th> <td>When enabled, the compiler will issue an error or a warning for unused import reference </td> </tr> <tr> <th align=left>syntheticAccess</th> <td>warn when performing synthetic access for innerclass</td> </tr> <tr> <th align=left>assertIdentifier</th> <td>warn occurrence of <i>assert</i> used as identifier</td> </tr> </table> </td> </tr> <tr> <td valign=top>-nowarn</td> <td>No warning (equivalent to <font color="#3366FF">-warn:none</font>)</td> </tr> <tr> <td valign=top>-deprecation</td> <td>Equivalent to <font color="#3366FF">-warn:deprecation</font>.</td> </tr> <tr> <td valign=top>-g[:none|:lines,vars,source] </td> <td>Set the debug attributes level<br> <table> <tr> <th align=left>-g</th> <td>All debug info (equivalent to <font color="#3366FF">-g:lines,vars,source</font>) </td> </tr> <th align=left>-g:none</th> <td>No debug info</td> </tr> <tr> <th align=left>-g:[lines,vars,source]</th> <td>Selective debug info</td> </tr> </table> </tr> <tr> <td valign=top>-preserveAllLocals</td> <td>Explicitly request the compiler to preserve all local variables (for debug purpose). If omitted, the compiler will removed unused locals.</td> </tr> <tr> <td valign=top>-noImportError</td> <td>The compiler won't report an error for unresolved imports. A warning is issued instead.</td> </tr> <tr> <td valign=top>-encoding <encoding name></td> <td>Specify default source encoding format (custom encoding can also be specifed on a per file basis by suffixing each input source file/folder name with <font color="#3366FF">[encoding <encoding name>]</font>).</td> </tr> <tr> <td valign=top>-log <filename></td> <td>Specify a log file in which all output from the compiler will be dumped. This is really useful if you want to debug the batch compiler or get a file which contains all errors and warnings from a batch build.</td> </tr> <tr> <td valign=top>-proceedOnError</td> <td>Keep compiling when error, dumping class files with problem methods or problem types. This is recommanded only if you want to be able to run your application even if you have remaining errors.</td> </tr> <tr> <td valign=top>-verbose</td> <td>Print accessed/processed compilation units in the console or the log file if specified.</td> </tr> <tr> <td valign=top>-referenceInfo</td> <td>Compute reference info. This is useful only if connected to the builder. The reference infos are useless otherwise.</td> </tr> <tr> <td valign=top>-progress</td> <td>Show progress (only in -log mode)</td> </tr> <tr> <td valign=top>-time </td> <td>Display speed information</td> </tr> <tr> <td valign=top>-noExit</td> <td>Do not call <font color="#3366FF">System.exit(n)</font> at end of compilation (<font color="#3366FF">n=0</font> if no error)</td> </tr> <tr> <td valign=top>-repeat <n> </td> <td>Repeat compilation process <font color="#3366FF"><n></font> times (perf analysis).</td> </tr> </table> </blockquote> </td> </tr> <tr> <td ALIGN=RIGHT VALIGN=TOP WIDTH="2%"><img SRC="http://dev.eclipse.org/images/Adarrow.gif" NOSAVE BORDER=0 height=16 width=16></td> <td WIDTH="98%"><b>Examples</b> <blockquote> <table> <td valign=top><font color="#3366FF">d:\temp -classpath rt.jar -time -g -d d:/tmp</font> </td> <td valign=top>It compiles all source files in d:\temp and its subfolders. The classpath is simply rt.jar. It generates all debug attributes and all generated .class files are dumped in d:\tmp. The speed of the compiler will be displayed once the batch process is completed.</td> </tr> <tr> <td valign=top><font color="#3366FF">d:\temp\Test.java -classpath d:\temp;rt.jar -g:none</font> </td> <td valign=top>It compiles only Test.java and it will retrieve any dependant files from d:\temp. The classpath is rt.jar and d:\temp, which means that all necessary classes are searched first in d:\temp and then in rt.jar. It generates no debug attributes and all generated .class files are dumped in d:\tmp.</td> </table> </blockquote> </td> </tr> </table> </body> </html>
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
