General discussion

Locked

Simple applet won't run - please help

By MadestroITSolutions ·
Hi all,
I am an experienced programmer trying to learn Java. I have a very simple applet that I cannot get to run for some reason. Please see the code below:

import java.applet.*;
import java.awt.*;

public class BLinkJVerCheck extends Applet
{
private Label m_labVersionVendor;
public void init()
{
Color colFrameBackground = Color.pink;
this.setBackground(colFrameBackground);
m_labVersionVendor = new Label (" Java Version: " +
System.getProperty("java.version") +
" from "+System.getProperty("java.vendor"));
this.add(m_labVersionVendor);
}
}

As you can see, this a pretty simple, straight forward applet, but for some reason when I attempt to run it on a web page, I get the following error (when I put the mouse on top of the square the applet is supposed to draw):

load: class BLinkJVerCheck not found

The tag on the web page:
<APPLET height="60" alt="Browser has Java disabled" hspace="22" width="440" code="BLinkJVerCheck.class" />

The applet file IS sitting in the same folder as the web page that calls it. When I compile the applet, everything goes ok, I get no errors and the class file is generated.

Any ideas....???... I always found Java annoying, and now that I finally want to make the move, I cannot get a stupid applet to work... please HELP!

Thank you in advance!

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by codecoaster In reply to Simple applet won't run - ...

I am a student in Java and I dont have that much experience of applets but you could try this to see if it works.

<applet codebase="http://www.mySite.com" code=BLinkVerCheck width=440 height=60>
Browser has Java Disabled
</applet>

or

<applet code="main" codebase="http://www.mySite.com" alt="Java not enabled" width="200" height="500" vspace="5" hspace="5" align="middle">

Collapse -

by MadestroITSolutions In reply to

Thank you for your answer. Unfortunately it did not help.

Collapse -

by islandjoe In reply to Simple applet won't run - ...

I tried running your code and it runs just fine (both in Firefox and IE).

Collapse -

by MadestroITSolutions In reply to

Thank you for your answer. Unfortunately it did not help.

Collapse -

by abrarbhai In reply to Simple applet won't run - ...

Hi,
There is an error in your tag:

<APPLET height="60" alt="Browser has Java disabled" hspace="22" width="440" code="BLinkJVerCheck.class" />

Replace with:
<APPLET height="60" alt="Browser has Java disabled" hspace="22" width="440" code="BLinkJVerCheck"></applet>

Error:
if you put BLinkJVerCheck.class it takes it like

Class class in a package BLinkJVerCheck --> Which obviously is not the case here.

Also, the applet tag does not work like regular XML tags.

Regards,
Abrar

Collapse -

by MadestroITSolutions In reply to

Thank you for your answer. Unfortunately it did not help.

Collapse -

by MadestroITSolutions In reply to Simple applet won't run - ...

This question was closed by the author

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums