eclipse中的 Compiler compliance level含义

The compiler compliance setting tells the compiler to pretend it's a different version of Java.

The Java 8 compiler will produce class files in the Java 8 version of the class file format, and accept Java 8 source files. JRE 6 can't load this version, because it was created after JRE 6 was.

If you set the compliance level to "JRE 6", it will instead compile Java 6 source files into Java 6 class files.

It's like saving a Word document as "Word 97-2003 format" - so that Word 97-2003 can read your document. You're saving the class files in Java 6 format so that Java 6 can read them.

 

我的理解就是 虽然eclipse使用的是jdk 8,但是通过设置 complier compliance setting 我们可以在jdk 6 (或其他) 环境中进行编译。 好比在word2010中将word文件保存为word2003的格式。

posted @ 2016-12-28 17:27  zh1164  阅读(4427)  评论(0编辑  收藏  举报