aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Problem Deploying Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Problem Deploying Applet" Watch "Problem Deploying Applet" New topic
Author

Problem Deploying Applet

Jeff Terry
Greenhorn

Joined: Apr 29, 2011
Posts: 7
Hello everyone!

I'm developing a Java applet for the web that I am having trouble deploying using Eclipse.

Info:
It uses an external jar (mysql-connector) in the build path.
The entry class is Main.class (no main method in there, it's just called Main) which is in package userInterfaces
I have tried Export -> JAR File to generate the JAR
I have tried using the open source Fat Jar Exporter to generate the JAR

However, when I try to run the applet within a browser (with the following HTML)
<html>
<title>My Applet</title>
<body>
<applet code="userInterface/Main.class"
archive="newProjectForm_fat.jar"
width=320 height=320>
</applet>
</body>
</html>

It always just shows an error saying that Main.class is not found

java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class userInterface.Main
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: Could not initialize class userInterface.Main
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)

Any help would be appreciated!

(hopefully I put this in the right place, I figured it's probably something wrong I am doing in eclipse)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18658
    
    8

Perhaps the applet isn't in that jar. Or perhaps it is, but not in the right place in the jar's directory structure. Or perhaps you didn't put the jar in the right place in your application server, so the browser can't see it.
Jeff Terry
Greenhorn

Joined: Apr 29, 2011
Posts: 7
I'm actually just running it from my desktop at the moment (the html page and the jar file are in the same spot).

The jars structure looks like

newProjectForm_fat.jar
- userInterface package
-class Main is directly in here
- guts package
- .svn directory
- com package
- META-INF package
- org package
<image files>
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Its a long time I have worked with applets, but this looks fishy to me

Shouldn't it me userInterface.Main.class ?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem Deploying Applet