gpt4 book ai didi

java - 通过网络浏览器运行小程序时抛出异常

转载 作者:太空宇宙 更新时间:2023-11-04 08:37:39 24 4
gpt4 key购买 nike

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

当我通过 appletviewer 实用程序运行此小程序时,它工作正常。但是,当我将此小程序嵌入 HTML 文件并尝试通过 Web 浏览器运行它时,我遇到了一些在运行时未找到的类的异常:-
Java Plug-in 1.6.0_18<br/>
Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM<br/>
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 运行时的一部分。

如何在浏览器中运行它?

提前非常感谢。

问候,
普拉斯

最佳答案

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

引用这个question .

关于java - 通过网络浏览器运行小程序时抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6009915/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com