Applet通过Web浏览器运行时抛出异常

时间:2011-05-15 17:07:38

标签: java applet appletviewer

我写了一个applet程序。它有一些来自java tools.jar的类的引用(例如: - import com.sun.jdi.connect.IllegalConnectorArgumentsException)

当我通过appletviewer实用程序运行此applet时,它工作正常。但是当我将这个小程序嵌入HTML文件并尝试通过Web浏览器运行时,我对运行时找不到的一些类有异常: - Java Plug-in 1.6.0_18
Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Pras

java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException 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: com/sun/jdi/connect/IllegalConnectorArgumentsException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(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.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: com.sun.jdi.connect.IllegalConnectorArgumentsException at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 14 more Caused by: java.io.FileNotFoundException: C:\pal\WTP_Workspace\JavaSocketBridge\bin\com\sun\jdi\connect\IllegalConnectorArgumentsException.class (The system cannot find the path specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(Unknown Source) at java.io.FileInputStream.(Unknown Source) at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source) at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 17 more Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException

然而,IllegalConnectorArgumentsException类是位于tools.jar内的java运行时的一部分。

我如何在浏览器中运行它?

提前多多感谢。

的问候,
普拉斯

1 个答案:

答案 0 :(得分:1)

您正在从JRE运行您的小程序。类IllegalConnectorArgumentsException只能从JDK访问,因为它与调试有关。

请参阅此question