ant java1.7,使用旧的JDK库降级Eclipse ant进行编译(Java 1.7 - > 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).

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.

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.

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.

解决方案

found it:

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值