为什么 Ant 给我一个 Unsupported major.minor version 错误 [英] Why is Ant giving me a Unsupported major.minor version error
本文介绍了为什么 Ant 给我一个 Unsupported major.minor version 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Ant 中运行这个目标.
<目标名称=编译"取决于=初始化"description="编译源代码";><!-- 将 ${src} 中的 java 代码编译到 ${build} --><javac srcdir="${src}";destdir="${build}"/></目标>
它给了我这个错误.
<前>C:\Users\..\workspace\..\build.xml:21: java.lang.UnsupportedClassVersionError:com/sun/tools/javac/Main:不支持的major.minor 版本51.0以下是版本:
Apache Ant(TM) 版本 1.8.2JDK 版本为 JDK 1.7.0
这是我在 Eclipse 中的编译器设置.
请帮我解决.
解决方案
在构建配置窗口中,运行时 jre 被设置为 jre 6 而不是 jre 7.
I'm running this target in Ant.
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
It's giving me this error.
C:\Users\..\workspace\..\build.xml:21: java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 51.0
Here are the versions:
Apache Ant(TM) version 1.8.2
JDK version is JDK 1.7.0
Here's my Compiler settings in Eclipse.
Please help me resolve it.
解决方案
The runtime jre was set to jre 6 instead of jre 7 in the build configuration window.
这篇关于为什么 Ant 给我一个 Unsupported major.minor version 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文