So I'm making a smiley face. It' compiles just fine, and at the run time it says "process completed" but the applet doesn't pop up. I have absolutely no idea what's going on!!

Here is the error message:

java.lang.NoSuchMethodError: main
Exception in thread "main" 
Process completed.

Here is the beginning part of my code:

 * @(#)
 * @author
 * @version 1.00 2010/9/25

import java.awt.*;

public class snow2 extends java.applet.Applet {

    /** Initialization method that will be called after the applet is loaded
     *  into the browser.
    public void init() {
        // TODO start asynchronous download of heavy resources

public void paint (Graphics page)
final int MID = 130;
final int TOP = 50;
setBackground (Color.cyan);
page.setColor (;
page.fillRect (0, 175, 300, 50); // ground
page.setColor (Color.yellow);
page.fillOval (260, 40,80, 80); // sun
page.setColor (Color.white);
page.fillOval (MID-20,TOP, 40, 40); // head
page.fillOval (MID-35,TOP+35, 70, 50); // upper torso
page.fillOval (MID-50,TOP+80, 100, 60); // lower torso
page.setColor (;
page.fillOval (MID-3,TOP+50, 6, 6); // button
page.fillOval (MID-3,TOP+60, 6, 6); // button
page.setColor (;
page.fillOval (MID-10,TOP+10, 5, 5); // left eye

Please if you can help me in anyway, I'd greatly appreciate it!

Recommended Answers

All 4 Replies

You should use a browser or the command: appletviewer in DOS window to open a html file where the applet code, i.e. the file of the applet code is in the same directory/folder, is available:
<html><applet code="####.class" width=400 height=500></applet></html>
There is nothing to do with main method.

So is there anything actually wrong with the code?

And how do I do that pplet viewer thing?

oh i thought that after you put it into java, it was just supposed to like pop up or something...after you like run it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.