使用较旧的JDK库降级Eclipse ant进行编译(Java 1.7 – > 1.6)

我有Upgrade Eclipse java compiler相反的问题:我正在使用可以支持JDK 1.7的Eclipse 3.7.1,但是现在正在开发JDK 1.6 …这是一直很好的工作,但突然之间我正在收到大量的错误,如这当我做一个蚂蚁构建(见下文).

我想使用JDK 1.6;我在哪里设置? Eclipse设置正确(每个项目的Java构建路径指向JRE System Library [jdk1.6.0_16]),但是ant似乎无视它.

[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工作区中构建这个特定的项目,从之前的工作区导入项目.我切换到旧的工作区,并建立了相同的项目,并且构建良好.

差异似乎是蚂蚁在我的新工作空间中的1.7 JRE中运行,但是Ant在我的旧工作区中的1.6 JRE中运行.是什么赋予了?我在哪里设置?我似乎无法弄明白哪个设置是不同的.

解决方法

找到了:

在Eclipse中的Ant选项卡中,如果您右键单击构建,然后单击运行方式 – > Ant Build …,那么它将弹出一个“编辑配置”对话框,您可以选择要用于Ant的JRE.

我不知道这个设置存储在哪里,但它似乎存储在工作区而不是项目设置中.

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...