As for the whole JDK, HotSpot is supported by Oracle Corporation on Microsoft Windows, Linux, Solaris, and Mac OS X. Supported ISAs are IA-32, x86-64, ARMv6, ARMv7, and SPARC (exclusive to Solaris).
Eclipse Compiler for Java(TM) bundle_qualifier, 3.9.0
Copyright IBM Corp 2000, 2013. All rights reserved.
Usage:
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
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
specify location for system classes. Each directory or
file can specify access rules for types between '['
and ']'
-sourcepath
specify location for application sources. Each directory
or file can specify access rules for types between '['
and ']'. Each directory can further specify a specific
destination directory using a '-d' option between '['
and ']'; this overrides the general '-d' option.
.class files created from source files contained in a
jar file are put in the user.dir folder in case no
general '-d' option is specified. ZIP archives cannot
override the general '-d' option
-extdirs
specify location for extension ZIP archives
-endorseddirs
specify location for endorsed ZIP archives
-d destination directory (if omitted, no directory is
created); this option can be overridden per source
directory
-d none generate no .class files
-encoding specify default encoding for all source files. Each
file/directory can override it when suffixed with
'['']' (e.g. X.java[utf8]).
If multiple default encodings are specified, the last
one will be used.
Compliance options:
-1.3 use 1.3 compliance (-source 1.3 -target 1.1)
-1.4 + use 1.4 compliance (-source 1.3 -target 1.2)
-1.5 -5 -5.0 use 1.5 compliance (-source 1.5 -target 1.5)
-1.6 -6 -6.0 use 1.6 compliance (-source 1.6 -target 1.6)
-1.7 -7 -7.0 use 1.7 compliance (-source 1.7 -target 1.7)
-source set source level: 1.3 to 1.7 (or 5, 5.0, etc)
-target set classfile target: 1.1 to 1.7 (or 5, 5.0, etc)
cldc1.1 can also be used to generate the StackMap
attribute
Warning options:
-deprecation + deprecation outside deprecated code (equivalent to
-warn:+deprecation)
-nowarn -warn:none disable all warnings
-nowarn:[]
specify directories from which optional problems should
be ignored
-?:warn -help:warn display advanced warning options
Error options:
-err: convert exactly the listed warnings
to be reported as errors
-err:+ enable additional warnings to be
reported as errors
-err:- disable specific warnings to be
reported as errors
Setting warning or error options using properties file:
-properties set warnings/errors option based on the properties
file contents. This option can be used with -nowarn,
-err:.. or -warn:.. options, but the last one on the
command line sets the options to be used.
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
Annotation processing options:
These options are meaningful only in a 1.6 environment.
-Akey[=value] options that are passed to annotation processors
-processorpath
specify locations where to find annotation processors.
If this option is not used, the classpath will be
searched for processors
-processor
qualified names of the annotation processors to run.
This bypasses the default annotation discovery process
-proc:only run annotation processors, but do not compile
-proc:none perform compilation but do not run annotation
processors
-s destination directory for generated source files
-XprintProcessorInfo print information about which annotations and elements
a processor is asked to process
-XprintRounds print information about annotation processing rounds
-classNames
qualified names of binary classes to process
Advanced options:
@ read command line arguments from file
-maxProblems max number of problems per compilation unit (100 by
default)
-log log to a file. If the file extension is '.xml', then
the log will be a xml file.
-proceedOnError[:Fatal]
do not stop at first error, dumping class files with
problem methods
With ":Fatal", all optional errors are treated as fatal
-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 repeat compilation process 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 in the console.
It does not affect the xml log output
-missingNullDefault report missing default nullness annotation
-? -help print this help message
-v -version print compiler version
-showversion print compiler version and continue
Ignored options:
-J
Compliance options:
-1.3 use 1.3 compliance (-source 1.3 -target 1.1)
-1.4 + use 1.4 compliance (-source 1.3 -target 1.2)
-1.5 -5 -5.0 use 1.5 compliance (-source 1.5 -target 1.5)
-1.6 -6 -6.0 use 1.6 compliance (-source 1.6 -target 1.6)
-1.7 -7 -7.0 use 1.7 compliance (-source 1.7 -target 1.7)
-source set source level: 1.3 to 1.7 (or 5, 5.0, etc)
-target set classfile target: 1.1 to 1.7 (or 5, 5.0, etc)
cldc1.1 can also be used to generate the
看来,我的ECJ最高支持支持到Java7,并且注意到 use 1.4 compliance 前有个 + 号。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#作为 DEMO 的 Java5App.java
public class Java5App { public static void main(String[] args) {
User user = new User(); user.java5(); }
/** * 使用了Java5新增的泛型集合List<E> */ public static class User { public void java5() { List<String> strings = new ArrayList<String>(); System.out.println("Java5"); } } }
---------- 1. ERROR in /Users/ljh/work/code/learningshowcase/classversion/src/main/java/com/liufor/learningshowcase/classversion/Java5App.java (at line 23) List<String> strings = new ArrayList<String>(); ^^^^^^ Syntax error, parameterized types are only available ifsource level is 1.5 or greater ---------- 2. ERROR in /Users/ljh/work/code/learningshowcase/classversion/src/main/java/com/liufor/learningshowcase/classversion/Java5App.java (at line 23) List<String> strings = new ArrayList<String>(); ^^^^^^ Syntax error, parameterized types are only available ifsource level is 1.5 or greater ---------- 2 problems (2 errors)%
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/liufor/learningshowcase/classversion/Java7App : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Preferences->Build,Execution,Deployment->Compiler->Java Compiler->Additional command line parameters:
上图中的 Javac Options 表示传递给 javac的参数,在UI上可以配置常见的3个,其他的通过 command line parameters 配置。
pom.xml可能影响IDEA的配置
IDEA 通过 IDEA plugin(Maven Integration)实现了对 Maven 的集成,Maven Integration 有一个隐藏的功能,可能会引起使用者的不适: 它会自动使 IDEA 的 Language level 和 Target bytecode version 和 pom.xml 保持一致,如果当你在IDEA中修改者两者后,却被莫名奇妙还原的话,你得修改 pom.xml 。
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.