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 5 of 5

Thread: HELP! My applet won't run on a web browser....

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    12
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default HELP! My applet won't run on a web browser....

    This is for an assignment I need to turn in tonight! My applet runs fine in Eclipse, but when I try to open it in a web browser, the screen goes white, acts like its loading something, but then quits and stays a white screen. I've got the .class file, .java file, and .html file all in the same directory from where I attempt to launch the .html file. I made an .html doc which reads:

    <applet code="<filename>.class" width="300" height="150">
    </applet>

    I made a different applet previously using the same .html file format above, with merely a different .class file name and it worked fine in a web browser!

    If anyone has any insight to the problem, PLEASE respond....

    Thanks in advance,
    -C


  2. #2
    Junior Member
    Join Date
    Sep 2011
    Posts
    12
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: HELP! My applet won't run on a web browser....

    One thing I just noticed, in the directory with all the files, there's a file named <filename>$1.class. This type of file is NOT present in the directory of the applet that DOES work in a web browser. I'm veeeeery new to programming and java, what does this type of file represent and would it be causing the problem?

    Thanks,
    -C

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Posts
    12
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: HELP! My applet won't run on a web browser....

    ...figured it out. I was using the wrong format in my html file. I switched it to the correct form and now the applet loads.

  4. #4
    Junior Member
    Join Date
    Sep 2011
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: HELP! My applet won't run on a web browser....

    What was the correct format? I have the same problem

  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP! My applet won't run on a web browser....

    Bertorox the correct way is to do the following.... I just solved mine.....


    <html>
    <title>UNDER CONSTRUCTION</title>
    <br>
    <body>
    <center>
    <applet code=Game.class codebase=dev/SUPINC/ name=Game
    width="1024" height="768">
    <param name="bgcolor" value="ffffff">
    <param name="fontcolor" value="000000">
    Your browser is not Java enabled.
    </applet>
    </center>
    </body>
    </html>


    Now my index.html file is in the root of my webhost ..... the Game.class is @ /dev/SUPINC/ so I used (codebase=dev/SUPINC/) to navigate to that directory to tell the page that's where my Game.class file is located.....

    ALSO VERY IMPORTANT!!! Make sure when you upload your items there'll be a file called (IN MY EXAMPLE) Game.class AND a file called Game$1.class

    YOU MUST UPLOAD THEM BOTH!

    That fixed my error

    You can see mine in action here: UNDER CONSTRUCTION

Similar Threads

  1. Embed SWING .JAR in Browser
    By ventrol in forum Java Applets
    Replies: 2
    Last Post: June 9th, 2011, 08:40 PM
  2. Replies: 10
    Last Post: January 12th, 2011, 05:48 AM
  3. japplet - jtable - browser
    By jasonnuigi in forum AWT / Java Swing
    Replies: 4
    Last Post: January 2nd, 2011, 05:20 AM
  4. print code to browser
    By bookface in forum Java Theory & Questions
    Replies: 4
    Last Post: April 21st, 2010, 01:09 AM
  5. how to get url, from browser in the socket class?
    By chinni in forum Java Networking
    Replies: 0
    Last Post: November 6th, 2009, 10:34 AM