ant Unsupported major.minor version 52.0

走远了吗. 提交于 2020-01-01 10:10:11

问题


This is driving me nuts.
When running any ant command (even ant -version), I always get the following error on Mac OSX:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported major.minor version 52.0

I removed and re-installed ant entirely, and still get the same error.

For our company we have to run Java7 to run the command, so I created an alias.

This used to work, I'm not sure what changed.


回答1:


I see you have java 1.7 installed and post that you have installed Ant 1.10.

Ant 1.10 requires jdk 8 Refer : http://ant.apache.org/

The Apache Ant team currently maintains two lines of development. The 1.9.x releases require Java5 at runtime and 1.10.x requires Java8 at runtime. Both lines are based off of Ant 1.9.7 and the 1.9.x releases are mostly bug fix releases while additional new features are developed for 1.10.x. We recommend using 1.10.x unless you are required to use versions of Java prior to Java8 during the build process.

Try using Ant 1.9.x if you can't use java 8



来源:https://stackoverflow.com/questions/49303389/ant-unsupported-major-minor-version-52-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!