2012-11-16 38 views
-1

我得到這個錯誤,並嘗試幾乎所有我能想到的。螞蟻不受支持的錯誤不會消失

我甚至重新安裝Ubuntu,從Oracle下載jdk 5,然後安裝maven2ant 1.8,但都是徒勞的。

我寫了一個helloworld'build.xml and ran ant`,但我仍然得到下面的錯誤。

只是想知道是否有一個隱藏的jar文件不符合正確版本的編譯器。

BUILD FAILED java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:300) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:88) at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:278) at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:185) at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:107) at org.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:120) at org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:104) at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:172) at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:273) at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:178) at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82) at org.apache.tools.ant.Main.runBuild(Main.java:793) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

回答

0

rg.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:120) at org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:104) at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:172) at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:273) at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:178) at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82) at org.apache.tools.ant.Main.runBuild(Main.java:793) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

看來你在類路徑錯誤版本的Apache罐子的,不以你的機器上的jdk運行編譯。

+0

謝謝Nambari,但它從哪裏挑選這些文件?我從.m2目錄以及/ usr/share/maven-repo中刪除了所有內容。 – Abidi

+0

檢查環境變量和build.xml中的類路徑條目。 – kosa