I have a spring project, it runs well in eclipse. But when i package it as a executable jar file and run it with command java -jar jar-name, it reports the following exception.
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/c
ontext/ApplicationContext
Caused by: java.lang.ClassNotFoundException: org.springframework.context.Applica
tionContext
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: cloud.ras.alert.RASAlertApp. Program will exit.
And even if i set the class-path value with springframework path, it still doesn't work. And can anyone give me a help? Many thanks.