Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Java Applet Doesn't Load on Web Browsers

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Applet Doesn't Load on Web Browsers

    It's a very simple program:

    import javax.swing.JApplet;
    import java.awt. Graphics;

    public class WelcomeApplet extends JApplet
    {
    public void paint(Graphics g)
    {
    super.paint(g);

    g.drawString("Welcome to Java!", 100,100);
    }
    }


    and the html :

    <html>
    <body>
    < applet code = "WelcomeApplet.class" width= "500" height= "300">
    </applet>
    </body>
    </html>


    The output that appears once it is loaded either in Mozilla or Chrome:
    < applet code = "WelcomeApplet.class" width= "500" height= "300">

    Please, help.


  2. #2
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: Java Applet Doesn't Load on Web Browsers

    Incorrect html line:
    HTML Code:
    < applet code = "WelcomeApplet.class" width= "500" height= "300">
    Remove the space between the '<' and the 'a' in applet


    A simple WelcomeApplet.html (works for me with Firefox to display the text from your applet):
    HTML Code:
    <html>
    <body>
      <applet code = "WelcomeApplet.class" width= "500" height= "300">
      </applet>
    </body>
    </html>
    Cheers!

    Z
    Last edited by Zaphod_b; November 1st, 2012 at 01:57 AM.

  3. #3
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Applet Doesn't Load on Web Browsers

    Thank you!

Similar Threads

  1. Replies: 29
    Last Post: May 18th, 2012, 03:16 PM
  2. Settlers of Catan Java Applet won't load
    By ragalie in forum JDBC & Databases
    Replies: 1
    Last Post: March 1st, 2012, 05:48 AM
  3. [SOLVED] Uploading a Java Applet embedded in HTML to a Web server
    By wizdom in forum What's Wrong With My Code?
    Replies: 20
    Last Post: December 3rd, 2011, 10:13 AM
  4. Java applet on web showing gray box
    By MyName in forum Java Applets
    Replies: 6
    Last Post: December 2nd, 2011, 03:53 PM
  5. Java Applet Will Not Load.
    By PaulMoretti in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 17th, 2011, 06:42 AM