Results 1 to 7 of 7
- 05-04-2008, 01:04 AM #1
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
[SOLVED] Please help me understand...
Hello, this is my first time here and I am in need of dire help. This is my first time coding in java and it has been nothing but a pain thus far. I can run a simple console app, but for some reason, the knowledge of how to run an applet is far beyond me. Two days I have been searching the internet endlessly for some ray of hope, but nothing... Can someone please tell me what I am doing wrong?
I have the latest versions of both Eclipse and Java on my system. The applet will load find inside Eclipse but fails when it comes to the browser.
My Class:
Html:Java Code:package helloWorld; import java.applet.Applet; import java.awt.*; public class HelloWorldApplet extends Applet { /** * */ private static final long serialVersionUID = 1L; public void paint(Graphics g){ g.drawString("Hello World!", 20, 30); this.setBackground(Color.blue); } }
Java Console Error:Java Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <applet code="HelloWorld.bin.helloWorld.HelloWorldApplet" width="400" height="200"></applet> </body> </html>
Java Code:Java Plug-in 1.6.0_05 Using JRE version 1.6.0_05 Java HotSpot(TM) Client VM User home directory = C:\Documents and Settings\Administrator ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to <n> ---------------------------------------------------- java.lang.NoClassDefFoundError: HelloWorld/bin/helloWorld/HelloWorldApplet (wrong name: helloWorld/HelloWorldApplet) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
- 05-04-2008, 11:51 AM #2
I never used that one before.code="HelloWorld.bin.helloWorld.HelloWorldApplet"
try to put that html beside your HelloWorldApplet.....
eg: CODE="HelloWorldApplet.class"freedom exists in the world of ideas
- 05-04-2008, 05:30 PM #3
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
I tired it and it still does not work!
Can someone tell me what this error means and how to reslove it:
Java Code:java.lang.NoClassDefFoundError: HelloWorldApplet (wrong name: helloWorld/HelloWorldApplet)
- 05-04-2008, 05:53 PM #4
try to remove that package at the top of your code.
Have you read about the Applet's Life Cycle?
Is HelloWorldApplet.java a compilable code?
is it generates a .class file beside the HelloWorldApplet.java?
Put your html beside that .class file.
What have you observe?
Update us,freedom exists in the world of ideas
- 05-05-2008, 12:27 AM #5
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
OMG IT WORKS!!! I remove the package but I got a complied error. So I recreated the class without specifying a package and it worked beautifully. Thank you so much for your patience, and guidance.
- 05-05-2008, 06:48 AM #6
If you are happy then mark the thread as SOLVED and give credit to your mentor by bumping up his reputation :)
Daniel @ [www.littletutorials.com]
Language is froth on the surface of thought
- 05-05-2008, 07:41 PM #7
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
Similar Threads
-
help me need to understand queries
By hossainsadd in forum JDBCReplies: 1Last Post: 05-26-2008, 12:02 AM -
Errors I don't understand
By MattyB in forum New To JavaReplies: 4Last Post: 04-01-2008, 11:55 PM -
New: Want to understand Drawing...
By diRisig in forum New To JavaReplies: 1Last Post: 02-05-2008, 08:13 AM -
i don understand this error
By Deon in forum New To JavaReplies: 4Last Post: 01-12-2008, 10:03 AM -
i can't understand using interface as a type
By sireesha in forum New To JavaReplies: 3Last Post: 11-20-2007, 10:07 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks