声明:本博文用于学习总结及工作心得
开发环境:
Windows7 64位,JDK1.7.0_17
安装过程请参考http://blog.csdn.net/yushuyou/article/details/50751506
在安装cordova,解压后配置好环境变量以后,运行ant命令时出现错误
xception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/to
ols/ant/launch/Launcher (Unsupported major.minor version 52.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.NET.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.Net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
注意:Unsupported major.minor version 52.0
52是指ant中.class文件对应的jdk是1.8版本的,如果当前JDK版本低于1.8就会出现以上错误
解决办法:在官网上下载老版本,比如apache-ant-1.9.6-bin.tar.bz2
解压后重新配置环境变量问题解决