Steps to Run Your Applet:

  1. Create a Java Program (HelloWorld.java) with the following code:
    import java.applet.Applet;
    import java.awt.Graphics;
    
    public class HelloWorld extends Applet {
        public void paint(Graphics g) {
            g.drawString("Hello world!", 50, 25);
        }
    }
    
  2. Compile it by javac HelloWorld.java.
  3. Create a HTML page (HelloWorld.html) to include the applet in <applet> tag as follows:
    <html>
    <head>
    <title>HelloWorld Applet</title>
    </head>
    <body>
    <center>
    This is HelloWorld Applet. <br>
    <applet code = "HelloWorld.class" hidth = 150 height = 50>
    </applet>
    </center>
    </body>
    </html>
    
  4. chmod 644 HelloWorld.html HelloWorld.class
  5. Click here to see the result.