eclipse中执行Ant脚本:Class not found: javac1.8

来源:互联网 发布:网络的弊辩论赛资料 编辑:程序博客网 时间:2024/06/06 04:05

最近把eclipse也升级到neon,java也同步升级到1.8,在eclipse中执行很久之前写的ant脚本(build.xml)时报错了:

Class not found: javac1.8

在命令行中执行ant脚本是正常的,因为我的电脑中安装了java1.6,1.7,1.8,但默认的版本是1.6,我知道我的ant脚本中指定了生成目标版本(target)是1.6。

在网上查了资料后,搞清楚了原因,原来是Ant版本太低,低于1.9,无法和java1.8兼容。于是到http://ant.apache.org/bindownload.cgi下载了1.10.1,解压到本地后,如下图修改了eclipse中的ant主目录参数,指定使用1.10.1。
这里写图片描述

再重新执行,恢复正常。

参考资料:

《Class not found: javac1.8”问题总结》
《 Could not find the main class: org.eclipse.ant.internal.launching.remote.InternalAntRunner》

阅读全文
0 1