Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Applet -> NoClassDefFoundError ?(Invoke Eclipse Applet from HTML -> NoClasDefFoundError )
Applet -> NoClassDefFoundError ? [message #1715760] Wed, 25 November 2015 18:56 Go to next message
Arthur Chan is currently offline Arthur ChanFriend
Messages: 44
Registered: September 2015
Member
Hi, I have created some applets in Eclipse and tried to run them from Firefox 42.0
Eclipse is on J2SDK1.7.0 and JRE is on 1.8.0, I have also set the Java Security to allow access to file:///C:/users/
When the applet is run from Eclipse, I got the right result.
But when I run the html from Firefox I got a "NoClassDefFoundError"

At the moment I don't know where the error is. Did some googling and seems like a lot of people have this problem since JRE1.8.0


error message:
-------------
security = 0
lapURL = file:/C:/Users/ARTHUR/eclipse/workspace/JavaTests/bin/java101//HelloWorld/
appArgs = ##docbase:file:/C:/Users/ARTHUR/eclipse/workspace/JavaTests/bin/java101/HelloWorld.html##Parameters:Y29kZQ===SGVsbG9Xb3JsZC5jbGFzcw==,Y29kZWJhc2U==ZmlsZTovLy9DOi9Vc2Vycy9BUlRIVVIvZWNsaXBzZS93b3Jrc3BhY2UvSmF2YVRlc3RzL2Jpbi9q
YXZhMTAxLw==,aGVpZ2h0=MTAw,amF2YV9hcmd1bWVudHM==,d2lkdGg==MzAw,
basic: error: HelloWorld (wrong name: java101/HelloWorld).
java.lang.NoClassDefFoundError: HelloWorld (wrong name: java101/HelloWorld)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
security: Reset deny session certificate store
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@ac7b65
security: Reset deny session certificate store



Eclipse applet
--------------

package java101;
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;

public class HelloWorld extends Applet {
	public void paint(Graphics g) {
		setBackground(Color.YELLOW);
		g.setColor(Color.BLACK);
		g.setFont(new Font("Times New Roman", Font.BOLD, 20));
		Frame frame = new Frame("Examples 9.1");
		frame.setSize(100, 100);
		// System.out.println("Hello World!");
		g.drawString("Hello World", 25, 50);
	}
}


html run from Firefox 42.0, in same directory as applet
---------------------------
<html><applet code="HelloWorld.class" width="300" height="100">
</applet>
</html>




Re: Applet -> NoClassDefFoundError ? [message #1715767 is a reply to message #1715760] Wed, 25 November 2015 21:55 Go to previous messageGo to next message
Arthur Chan is currently offline Arthur ChanFriend
Messages: 44
Registered: September 2015
Member
OK, I added the package name to the html and that overcame the error.

Question: In Eclipse, where can I specify the output directory when I export HelloWorld.class to a .jar file?

Re: Applet -> NoClassDefFoundError ? [message #1715866 is a reply to message #1715767] Thu, 26 November 2015 19:10 Go to previous message
Arthur Chan is currently offline Arthur ChanFriend
Messages: 44
Registered: September 2015
Member
OK, problem solved. Thanks
Previous Topic:string style
Next Topic:Unable to install Spring IDE using Marketplace
Goto Forum:
  


Current Time: Tue Apr 16 13:36:30 GMT 2024

Powered by FUDForum. Page generated in 0.60286 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top