我有一個程序在ECLIPSE中成功運行。但是,生成.jar文件並嘗試運行時會生成錯誤。部署Eclipse - 錯誤執行文件.jar - Spring批處理
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/batch/core/JobExecutionException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.springframework.batch.core.JobExecutionException
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)
... 7 more
該類信息org/springframework/batch/core/
它在項目中被引用。
任何想法如何解決?
檢查您的jar文件的classapth。通過eclipse創建jar文件時有多個選項 – Shriram