Ste*_*n C 21
这取决于.如果您的程序不使用新的Java 7语言扩展,那么您可以使用-source 1.6和-target 1.6选项运行Java编译器.但是如果使用Java 7语言扩展,-source 1.6则会导致编译错误.
当然,我知道在这样做时我不能使用新的Java 7功能.
这包括Java 7语言特性......以及对Java 7的依赖性对标准类库API的更改.另请注意,存在少量行为差异(即API错误修复)可能导致代码在Java 6和Java 7上以不同方式运行.应在Java 6到Java 7转换文档中对其进行描述.
更新 - 无论如何,这可能不再是一个问题,因为Oracle已经发布了适用于Mac OSX的Java 7.
我安装了jdk6.如果你查看javac的手册页:
Cross-Compilation Options
By default, classes are compiled against the bootstrap and extension classes of the platform that javac shipped with. But javac also supports cross-compil?
ing, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use -bootclasspath
and -extdirs when cross-compiling; see Cross-Compilation Example below.
-target version
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier
versions of the VM. Valid targets are 1.1 1.2 1.3 1.4 1.5 (also 5) and 1.6 (also 6).
Run Code Online (Sandbox Code Playgroud)