Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-04-2008, 03:04 AM
Member
 
Join Date: May 2008
Posts: 26
Master Zero is on a distinguished road
[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:
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); } }
Html:
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 Console Error:
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)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-04-2008, 01:51 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Quote:
code="HelloWorld.bin.helloWorld.HelloWorldApplet"
I never used that one before.
try to put that html beside your HelloWorldApplet.....

eg: CODE="HelloWorldApplet.class"
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-04-2008, 07:30 PM
Member
 
Join Date: May 2008
Posts: 26
Master Zero is on a distinguished road
I tired it and it still does not work!

Can someone tell me what this error means and how to reslove it:
Code:
java.lang.NoClassDefFoundError: HelloWorldApplet (wrong name: helloWorld/HelloWorldApplet)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-04-2008, 07:53 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
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,
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-05-2008, 02:27 AM
Member
 
Join Date: May 2008
Posts: 26
Master Zero is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 05-05-2008, 08:48 AM
danielstoner's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Canada
Posts: 191
danielstoner is on a distinguished road
If you are happy then mark the thread as SOLVED and give credit to your mentor by bumping up his reputation
__________________
Daniel @ [
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
]
Language is froth on the surface of thought
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 05-05-2008, 09:41 PM
Member
 
Join Date: May 2008
Posts: 26
Master Zero is on a distinguished road
Done, except I don't know how to mark the thread as sloved!

*Found it.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help me need to understand queries hossainsadd Database 1 05-26-2008 02:02 AM
Errors I don't understand MattyB New To Java 4 04-02-2008 01:55 AM
New: Want to understand Drawing... diRisig New To Java 1 02-05-2008 10:13 AM
i don understand this error Deon New To Java 4 01-12-2008 12:03 PM
i can't understand using interface as a type sireesha New To Java 3 11-21-2007 12:07 AM


All times are GMT +3. The time now is 08:22 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org