loading applet on web browser


I am trying to load applet on web browser.
I placed HelloApplet.class and HelloApplet.html same dir(home_dir/public_html/../..).
However, when I tried to load by typing "http://www....../HelloApplet.html,
just "Hello, Applet World!" from HelloApplet.html file appears, and there is
no string or clickable button on the browser. It just shows gray area...that's it.
Why is that?

Thanks for help.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class HelloApplet extends JApplet {

   private int currentIndex = 0;
   public void init() {
      final String[] MESSAGES = {"Hello, Applet World!","Still here"};
      final JLabel DISPLAY_LABEL = new JLabel("");
      JButton showButton = new JButton("Click here for a message " +
                                 "from our sponsor!");
      showButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            currentIndex = (currentIndex + 1) % MESSAGES.length;
      Container contentPane = getContentPane();
      contentPane.add(showButton, BorderLayout.NORTH);
      contentPane.add(DISPLAY_LABEL, BorderLayout.CENTER);


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  <title>Hello, Applet World!</title>
<h1>Hello, Applet World!</h1>

<applet code="HelloApplet.class" width="400" height="100">
Error, your browser does not understand applet tags!

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you are using MSIE did you? :)

you haven't enable Sun Java Plug-IN for runnig applets, so IE tries to run your applet, using it's own olm Microsoft JVM 1.1 , and this JVM doesn't know about new Swing classes and so on.

 So go to control panel, run Java Plugin and click enable :)
it's work fine with Plug-In
dkim18Author Commented:
Thank you for your answer, but I don't see Enable Java Plug-in option on Basic Panel and any other panel.
The "Advanced" panel?

It's about half way down the list of checkboxes
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.


Tools -> Internet Options -> Advanced
Of course, you will need the plugin from http://java.sun.com/getjava if you don't already have it...
dkim18Author Commented:
I tried all, but it wasn't successful. I don't know why...
When I try to run, I see "java.lang.NoClassDefFoundError:HelloApplet$1." on bottom of web broswer.
Have you copied all your class files?

Sounds like you have inner/anonymous classes in your applet, and you aren't copying their class files to the webserver...

dkim18Author Commented:
I ftp HelloApplet$1.class as well and the applet starts, but I still don't see clickable button and messages"
What is difference "HelloApplet$1.class" and "HelloApplet.class"? When I compiled, I got both classes file.
There is no inner class in my applet by the way.(from above source)

I 'd apprecatied your comments
showButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
            currentIndex = (currentIndex + 1) % MESSAGES.length;

is an anonymous inner class

what shows up on the java console when you try to load the applet?

try CTRL-Refresh instead of just refresh to load the applet...

That clears the cache...
dkim18Author Commented:
It shows up "Hello, Applet World!" and the bottom web broswer says 'Applet HelloApplet Started and then if I mouse my mouse to gray box then the msg chagnes to 'loading java applet...' and it takes forever.  I did try CTRL-Refresh option, but didn't work.
Is it server problem? I asked to a friend of mine to load the applet and he got same problem...
dkim18, look, i've tested your applet with MSIE and Netscape, with installed Sun Java PlugIN, it works fine :)

so download J2SDK 1.4.2 from java.sun.com, install it (don't forget to check Java Plug-in for IE and Netscape), and all should work fine.

if you haven't java plug-in , your IE will use Microsoft Old JVM 1.1, so your applet won't work. Certanly you can compile it for JVM 1.1, like this:
      java -target 1.1 *.java
, but i think your Swing classes won't be found, cause Microsoft JVM too old and don't know about it.

> I ftp HelloApplet$1.class as well and the applet starts, but I still don't see clickable button and messages"

you should upload all .class files, there will be 2 files in your case

by the way, do you tested it on local machine? does it work?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.