I have an applet that contains about 30 different class files, all held within two different packages (userInterface and guts), as well as some image files. It also uses an external jar (mysql-connector).
Im having problems viewing it within a browser, though it runs fine in Eclipse. I'm not trying to run it off of a server yet, I'm just putting the project jar file (new.jar) and the html page I create in the same directory (C:/Users/Jeff/Desktop/applet/) on my system, and running it from there.
The class which extends JApplet is in the userInterface package, and is called Main.
Here is my HTML:
<html>
<title>My Applet</title>
<body>
<applet archive='new.jar',
code='userInterface.Main.class',
width=500,
height=500 />
</body>
</html>
I've read through quite a few posts from others experiencing similar issues, but still haven't had any luck after trying to implement their solutions
Thanks for any help you can offer
*EDIT*: I just tried moving 'Main.class' from my jar into a directory (/applet/userInterface/) and changing my html code line to code='userInterface.Main', and am now getting the following errors:
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
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.ExceptionInInitializerError
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.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkExit(Unknown Source)
at java.lang.Runtime.exit(Unknown Source)
at java.lang.System.exit(Unknown Source)
at guts.DBHelper.getConnection(DBHelper.java:43)
at userInterface.Main.<clinit>(Main.java:29)
... 21 more
Exception: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
Could this be due to problems connecting to remote db?
I added a java.policy file with:
grant {
permission java.security.AllPermission;
};
to the /applet/ directory, so hopefully this portion of the problem should be fixed.