New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export runnable JAR files from within eclipse [SPR-17544] #22076
Comments
huangliusong commented Spring-based project to export into a jar to do then, the second option of eclipse is used to derive the executable jar, couldn't find the namespace, normal, in the eclipse runtime is derived when won't run, https://gitee.com/huangliusong/demo2 this is the source code, hope you glad |
huangliusong commented These are exception messages when it run
huangliusng:Desktop liusonghuang$ java -jar aaa.jar Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more |
Zhang Jie commented If you want to run spring-based project with command "java -jar aaa.jar", you must specify the dependencies jar using -classpath, or you can package a "fat" jar whitch contains all dependencies in one single jar. I see that you are using maven, you can try Maven Assembly Plugin and package jar using maven instead of eclipse.Or you can simply use spring-boot. |
huangliusong commented Thank you for your reply,Because of technical requirements that we cannot build projects using maven, we cannot use maven's packaged plug-ins.we can't use springboot to build projects either.How can I package a ''fat'' jar? |
Stéphane Nicoll commented This looks like more a question than a bug report and we don't use the issue tracker for that. Please use StackOverflow. |
huangliusong commented ok ,you are right |
huangliusong opened SPR-17544 and commented
Spring-based project to export into a jar to do then, the second option of eclipse is used to derive the executable jar, couldn't find the namespace, normal, in the eclipse runtime is derived when won't run, https://gitee.com/huangliusong/demo2 this is the source code, hope you glad
No further details from SPR-17544
The text was updated successfully, but these errors were encountered: