1

I have written an applet program. It has some references to classes from java tools.jar in it (eg:- import com.sun.jdi.connect.IllegalConnectorArgumentsException)

When I run this applet through appletviewer utility it works fine. But when I embed this applet in HTML file and try to run it through web browser, I am getting exception about some classes not found at runtime:- 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

However the IllegalConnectorArgumentsException class is part of java runtime located inside tools.jar.

How I can get run it inside browser as well?

many thanks in advance.

Regards,
Pras

Roman C
  • 49,761
  • 33
  • 66
  • 176
Pras
  • 11
  • 4

1 Answers1

1

You are running your applet from the JRE. The class IllegalConnectorArgumentsException can only be access from the JDK since it's related to debugging.

Refer to this question.

Community
  • 1
  • 1
h3xStream
  • 6,293
  • 2
  • 47
  • 57
  • Even when running from a JDK, the `tools.jar` would not by default be on the run-time class-path of an applet. – Andrew Thompson May 15 '11 at 17:26
  • Then it's probably, the security restriction of the applet environment. The appletviewer has almost no restriction. You are not limited to the classes accessible and can open connection to any host for exemple (with the appletviewer). – h3xStream May 15 '11 at 17:36