我有一个带有main()语句的jar文件,该语句实例化并调用axis2 Web服务存根。它似乎无法找到org.apache.axis2.AxisFault,尽管它在我的类路径上。我在Windows 7上运行1.6.0_25。我的命令如下:
java -classpath "C:\Program Files\Apache Software Foundation\axis2-1.5.4\lib\axis2-kernel-1.5.4.jar" -jar .\build\lib\SoapClient-test-client.jar
例外是:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/AxisFault
Caused by: java.lang.ClassNotFoundException: org.apache.axis2.AxisFault
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)
答案 0 :(得分:2)
-jar
使java忽略任何-cp
个jar。调整清单中的Class-Path。