java.lang.NoClassDefFoundError:org / apache / xmlbeans / XmlException即使添加jar

时间:2018-12-24 16:37:29

标签: java exception jar classpath

我已从eclipse中将Java作为jar导出,执行jar文件时出现以下错误。

java -jar xmlparser.jar
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/xmlbeans/XmlException
Caused by: java.lang.ClassNotFoundException: 
org.apache.xmlbeans.XmlException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: 
com.sdm.massupload.xmlconfig.impl.ResourceConfig. Program will exit.

我已经将xbean.jar添加到类路径中,并且该jar存在于物理位置。下面是jar的类路径文件

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" 
  path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Softwares/xmlbeans- 2.3.0/lib/jsr173_1.0_api.jar"/>
<classpathentry kind="lib" path="C:/Softwares/xmlbeans-   2.3.0/lib/xbean_xpath.jar"/>
<classpathentry kind="lib" path="C:/Softwares/xmlbeans-   2.3.0/lib/resolver.jar"/>
<classpathentry kind="lib" path="C:/Softwares/xmlbeans-    2.3.0/lib/xmlbeans-qname.jar"/>
<classpathentry kind="lib" path="C:/Softwares/xmlbeans-    2.3.0/lib/xbean.jar"/>
<classpathentry exported="true" kind="lib" path="C:/Codebase/hdmport 
(1)/hdmport/hdmport/lib/common/xmlconfig.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

请帮助我。预先感谢!

1 个答案:

答案 0 :(得分:0)

此类org.apache.xmlbeans.XmlExceptionxmlbeans-2.3.0.jar库中。您可以从this链接下载它,然后将其作为依赖项添加到您的项目中