eclipse的java编译器命令行

本文介绍了 Eclipse Java 编译器 ecj 的使用方法及其特性。ecj 是 Eclipse 平台自带的 Java 编译器,能够支持从 Java 1.3 到 Java 1.6 的代码编译,并且提供了丰富的编译选项。
汗,刚刚突然发现我的javac是eclipse的java编译器。留念下。
stlxv@stlxvcomputer:~$ javac -version
Eclipse Java Compiler v_686_R32x
, 3.2.2 release, Copyright IBM Corp 2000, 2006. 

这东西原名叫ecj,不过我也不知道是哪里冒出来的。算了,这个东西编译速度挺快的,我觉得。
stlxv@stlxvcomputer:~$ update-alternatives --display javac
javac - status is auto
.
 link currently points to 
/usr/bin/ecj
/usr/lib/jvm/java-6-sun/bin/javac - priority 63
 slave javac
.1.gz: /usr/lib/jvm/java-6-sun/man/man1/javac.1.gz
/usr/bin/ecj - priority 143
 slave javac
.1.gz: /usr/share/man/man1/ecj.1.gz
Current `best' version is 
/usr/bin/ecj.

可编译1.3~1.6的代码。
stlxv@stlxvcomputer:~$ javac
Eclipse Java Compiler v_686_R32x
, 3.2.2 release
Copyright IBM Corp 
2000, 2006. All rights reserved.
 
 Usage: 
<options> <source files | directories>
 
If directories are specified, then their source contents are compiled.
 Possible options are listed below
. Options enabled by default are prefixed
 with '
+'.
 
 Classpath options:
    -cp -classpath 
<directories and zip/jar files separated by :>
                       specify location 
for application classes and sources.
                       Each directory or file can specify access rules 
for
                       types between '[' and ']' 
(e.g. [-X] to forbid
                       access to 
type X, [~X] to discourage access to type X,
                       [
+p/X:-p/*] to forbid access to all types in package p
                       but allow access to p
/X)
    -bootclasspath 
<directories and zip/jar files separated by :>
                       specify location 
for system classes. Each directory or
                       file can specify access rules 
for types between '['
                       and ']'
    -sourcepath 
<directories and zip/jar files separated by :>
                       specify location 
for application sources. Each directory
                       or file can specify access rules 
for types between '['
                       and ']'
.
                       
.class files created from source files contained in a
                       jar file are put in the user
.dir folder in case no
                       destination directory is specified
.
    -extdirs 
<directories separated by :>
                       specify location 
for extension zip/jar files
    -endorseddirs 
<directories separated by :>
                       specify location 
for endorsed zip/jar files
    -d 
<dir>           destination directory (if omitted, no directory is
                       created
)
    -d none            generate no 
.class files
    -encoding 
<enc>    specify custom encoding for all sources. Each
                       file
/directory can override it when suffixed with
                       '['
<enc>']' (e.g. X.java[utf8])
 
 Compliance options:
    -
1.3               use 1.3 compliance level (implicit -source 1.3
                       -target 
1.1)
    -
1.4             + use 1.4 compliance level (implicit -source 1.3
                       -target 
1.2)
    -
1.5               use 1.5 compliance level (implicit -source 1.5
                       -target 
1.5)
    -
1.6               use 1.6 compliance level (implicit -source 1.6
                       -target 
1.6)
    -source 
<version>  set source level: 1.3 to 1.6 (or 5, 5.0, 6 or 6.0)
    -target 
<version>  set classfile target level: 1.1 to 1.6 (or 5, 5.0, 6 or
                       
6.0)
 
 Warning options:
    -deprecation     
+ deprecation outside deprecated code
    -nowarn            disable all warnings
    -warn
:none         disable all warnings
    -warn:
<warnings separated by ,>    enable exactly the listed warnings
    -warn:
+<warnings separated by ,>   enable additional warnings
    -warn:-
<warnings separated by ,>   disable specific warnings
      allDeprecation       deprecation including inside deprecated code
      allJavadoc           invalid or missing javadoc
      assertIdentifier   
+ 'assert' used as identifier
      boxing               autoboxing conversion
      charConcat         
+ char[] in String concat
      conditionAssign      possible accidental boolean assignment
      constructorName    
+ method with constructor name
      dep-ann              missing @Deprecated annotation
      deprecation        
+ deprecation outside deprecated code
      discouraged        
+ use of types matching a discouraged access rule
      emptyBlock           undocumented empty block
      enumSwitch           incomplete enum switch
      fallthrough          possible fall-through case
      fieldHiding          field hiding another variable
      finalBound           
type parameter with final bound
      finally            
+ finally block not completing normally
      forbidden          
+ use of types matching a forbidden access rule
      hiding               macro 
for fieldHiding, localHiding, typeHiding and
                           maskedCatchBlock
      incomplete-switch    same as enumSwitch
      indirectStatic       indirect reference to static member
      intfAnnotation     
+ annotation type used as super interface
      intfNonInherited   
+ interface non-inherited method compatibility
      javadoc              invalid javadoc
      localHiding          local variable hiding another variable
      maskedCatchBlock   
+ hidden catch block
      nls                  string literal lacking non-nls tag 
//$NON-NLS-<n>$
      noEffectAssign     
+ assignment without effect
      null                 missing or redundant null check
      over-ann             missing @Override annotation
      paramAssign          assignment to a parameter
      pkgDefaultMethod   
+ attempt to override package-default method
      raw                  usage of raw 
type
      semicolon            unnecessary semicolon
, empty statement
      serial             
+ missing serialVersionUID
      specialParamHiding   constructor or setter parameter hiding another field
      static-access        macro 
for indirectStatic and staticReceiver
      staticReceiver     
+ non-static reference to static member
      suppress           
+ enable @SuppressWarnings
      synthetic-access     same as syntheticAccess
      syntheticAccess      synthetic access 
for innerclass
      tasks
(<tags separated by |>) tasks identified by tags inside comments
      typeHiding         
+ type parameter hiding another type
      unchecked          
+ unchecked type operation
      unnecessaryElse      unnecessary 
else clause
      unqualified-field-access same as unqualifiedField
      unqualifiedField     unqualified reference to field
      unused               macro 
for unusedArgument, unusedImport, unusedLabel,
                               unusedLocal
, unusedPrivate and unusedThrown
      unusedArgument       unread method parameter
      unusedImport       
+ unused import declaration
      unusedLabel        
+ unused label
      unusedLocal        
+ unread local variable
      unusedPrivate      
+ unused private member declaration
      unusedThrown         unused declared thrown exception
      uselessTypeCheck     unnecessary cast
/instanceof operation
      varargsCast        
+ varargs argument need explicit cast
      warningToken       
+ unhandled warning token in @SuppressWarnings
 
 
Debug options:
    -g[
:lines,vars,source] custom debug info
    -g
:lines,source  + both lines table and source debug info
    -g                 all 
debug info
    -g
:none            no debug info
    -preserveAllLocals preserve unused local vars 
for debug purpose
 
 Ignored options:
    -J
<option>         pass option to virtual machine (ignored)
    -X
<option>         specify non-standard option (ignored)
    -X                 
print non-standard options and exit (ignored)
    -O                 optimize 
for execution time (ignored)
 
 Advanced options:
    @
<file>            read command line arguments from file
    -maxProblems 
<n>   max number of problems per compilation unit (100 by
                       default
)
    -log 
<file>        log to a file. If the file extension is '.xml', then
                       the log will be a xml file
.
    -proceedOnError    
do not stop at first error, dumping class files with
                       problem methods
    -verbose           enable verbose output
    -referenceInfo     compute reference info
    -progress          show progress 
(only in -log mode)
    -
time              display speed information 
    -noExit            
do not call System.exit(n) at end of compilation (n==0
                       
if no error)
    -repeat 
<n>        repeat compilation process <n> times for perf analysis
    -inlineJSR         inline JSR bytecode 
(implicit if target >= 1.5)
    -enableJavadoc     consider references in javadoc
    -Xemacs            used to enable emacs-style output
 
    -? -help           
print this help message
    -v -version        
print compiler version
    -showversion       
print compiler version and continue
















 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值