问题描述
我有与相反的问题:我使用Eclipse 3.7 .1 可以支持JDK 1.7,但是现在我正在开发JDK 1.6 ...这是一个很好的工作,但是当我做一个蚂蚁构建的时候,我突然发现这样的错误(见下文)。
I have the opposite problem as Upgrade Eclipse java compiler: I'm using Eclipse 3.7.1 that can support JDK 1.7, but right now I am developing for JDK 1.6... which has been working fine, but suddenly I'm getting tons of errors like this when I do an ant build (see below).
我想使用JDK 1.6;我在哪里设置? Eclipse设置正确(每个项目的Java Build Path指向JRE System Library [jdk1.6.0_16]),但是蚂蚁似乎无视它。
I want to use JDK 1.6; where do I set that? Eclipse is set properly (Java Build Path for each project points to JRE System Library [jdk1.6.0_16]), but ant seems to be disregarding it.
[javac] warning: java\nio\ByteBuffer.class(java\nio:ByteBuffer.class): major version 51 is newer than 50, the highest major version supported by this compiler.
[javac] It is recommended that the compiler be upgraded.
[javac] warning: java\lang\Object.class(java\lang:Object.class): major version 51 is newer than 50, the highest major version supported by this compiler.
[javac] It is recommended that the compiler be upgraded.
[javac] warning: java\util\Collections.class(java\util:Collections.class): major version 51 is newer than 50, the highest major version supported by this compiler.
[javac] It is recommended that the compiler be upgraded.
[javac] warning: java\util\EnumMap.class(java\util:EnumMap.class): major version 51 is newer than 50, the highest major version supported by this compiler.
[javac] It is recommended that the compiler be upgraded.
更新:更多线索 - 这是第一个时间我已经在一个单独的Eclipse工作区中构建了这个特定的项目,从之前的工作区导入项目。我转而回到旧的工作区,并建立了相同的项目,并建立了良好的状态。
update: More clues -- this is the first time I've built this particular project in a separate Eclipse workspace that imports the project from a previous workspace. I switched back to the old workspace and built the same project and it builds fine.
差异似乎是蚂蚁在我的新工作区中的1.7 JRE中运行,但是蚂蚁在我的旧工作区中的1.6 JRE中运行。是什么赋予了?我在哪里设置?我似乎无法弄清楚哪个设置是不同的。
The difference seems to be that ant runs in a 1.7 JRE in my new workspace, but ant runs in a 1.6 JRE in my old workspace. What gives? Where do I set this? I can't seem to figure out which setting is different.
推荐答案
发现:
在Eclipse的Ant选项卡中,如果您右键单击构建,然后单击运行方式 - >Ant构建,则会弹出编辑配置对话框,您可以选择要用于Ant的JRE。
In the Ant tab in Eclipse, if you right-click on your build, and click Run As -> Ant Build..., then it will pop up an "Edit Configuration" dialog box, and you can select which JRE you want to use for Ant.
我不知道此设置存储在哪里,但它似乎存储在工作区而不是项目中设置。
I don't know where this setting is stored, but it appears to be stored in the workspace rather than with the project settings.
这篇关于使用旧的JDK库降级Eclipse ant进行编译(Java 1.7 - > 1.6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!