java -jar 执行 eclipse export 的 jar 包报错处理

Posted digdeep

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java -jar 执行 eclipse export 的 jar 包报错处理相关的知识,希望对你有一定的参考价值。

1. 错误1

F:\>java -jar remoteLogin.jar
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/alibaba/fastjson/JSON
at com.diantusoft.LoginWindow.getFingerPrintFromDB(LoginWindow.java:819)
at com.diantusoft.LoginWindow.login(LoginWindow.java:630)
at com.diantusoft.LoginWindow.access$8(LoginWindow.java:577)
at com.diantusoft.LoginWindow$13.mouseClicked(LoginWindow.java:509)
at java.awt.Component.processMouseEvent(Component.java:6528)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4542)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:751)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:702)
at java.awt.EventQueue$3.run(EventQueue.java:696)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:724)
at java.awt.EventQueue$4.run(EventQueue.java:722)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:721)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: com.alibaba.fastjson.JSON
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

解决方法:Use Export -> Java -> Runnable JAR File instead Export -> Java -> JAR File on your project (right mouse click).

2. 错误2: Could not find main method from given launch configuration

原因:选错了 launch configuration,自然就找不到 main方法,选择时要选择那个包括 main 方法的 类作为 launch

 

 

以上是关于java -jar 执行 eclipse export 的 jar 包报错处理的主要内容,如果未能解决你的问题,请参考以下文章

是否有使用 react native expo 执行后台任务的技巧?

redux 操作功能无法正确执行 - expo“可能未处理的承诺拒绝”

未知的执行上下文错误 - 将领域导入 Expo React Native IOS 应用程序

React Navigation(使用 Expo) - MainActivity.java 文件的位置?

在 Eclipse 中显示 Java 应用程序的执行脚本

调试java程序时如何在eclipse中执行某些功能?