在jar文件上执行main调用时发生错误

时间:2013-04-04 10:07:19

标签: java

当我运行与Jar文件相关的Main类时,我遇到了以下错误。有人请帮助我。感谢。

D:\data\Gateway\dist>java -jar Gateway.jar com.Application
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractApplicationContext
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.support.AbstractApplicationContext
        at java.net.URLClassLoader$1.run(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)
        ... 6 more

1 个答案:

答案 0 :(得分:3)

消息

java.lang.NoClassDefFoundError: 
    org/springframework/context/support/AbstractApplicationContext

表示必须将jar org.springframework.context添加到类路径中。