环境: centos 7.2 jdk version 1.7.0_79 ant version 1.9.9
如果报这个错,说明是服务器上目前的JDK版本不正确
1
2
3
4
5
6
[root@localhost local]# ant --version
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported maj
or.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
官方说明
1
2
3
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.
Currently, Apache Ant 1.9.9 and 1.10.1 are the best available versions, see the release notes.