0

我在 Eclipse 中工作,从 Eclipse 触发时应用程序和小程序运行良好,但是当我导出 .jar 文件并尝试运行它时,它会抛出无法运行的错误并检查控制台,但我无法启动控制台. 其次,当我从网页运行小程序时,出现 java 错误。

这可能是一个简单的解决方法,但我已经向许多人寻求帮助但无济于事,所以提前谢谢你。如果您需要更多信息,请告诉我,我会提供。

http://forevanyeung.com/javapuzzle/

类结构

+-Puzzle
|+-src
||+-(default package)
|||-Applet.java
||+-puzzle
|||-Puzzle.java
|||-PuzzleLogic.java
|||-Tile.java
|||-TileMouseHandler.java
|+-img
||-richard.jpg

HTML 小程序

<applet code="Applet" archive="puzzle.jar" width="308" height="308"></applet>

Java 错误

java.lang.RuntimeException: java.lang.NoClassDefFoundError: puzzle/PuzzleLogic
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: puzzle/PuzzleLogic
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethod(Unknown Source)
    at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
    at java.awt.Component.access$500(Unknown Source)
    at java.awt.Component$3.run(Unknown Source)
    at java.awt.Component$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Component.checkCoalescing(Unknown Source)
    at java.awt.Component.<init>(Unknown Source)
    at java.awt.Container.<init>(Unknown Source)
    at java.awt.Panel.<init>(Unknown Source)
    at java.awt.Panel.<init>(Unknown Source)
    at java.applet.Applet.<init>(Unknown Source)
    at javax.swing.JApplet.<init>(Unknown Source)
    at Applet.<init>(Applet.java:18)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: puzzle.PuzzleLogic
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 37 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: puzzle/PuzzleLogic
4

0 回答 0