java.lang.NoSuchMethodError: main

import javax.swing.*;

import java.awt.*;

publicclass HappyFaceextends JApplet

{

publicvoid paint(Graphics canvas)

{

canvas.drawOval(100,50,200,200);

canvas.fillOval(155,100,10,20);

canvas.fillOval(230,100,10,20);

canvas.drawArc(150,160,100,50,180,180);

}

}

Hi all,

Ive just started learning Java at uni this semester and we are following Java 4th edition by walter savitch

Im having troubles with this error, does anyone know what it means...

to my primitive understanding im assuming it cant find the librarys javax.swing etc... the coding above is an example in the text and it is supposed to draw a smile face, however after executing the class it gives me that runtime error....

any help would be great

[1147 byte] By [Alexander_Zohara] at [2007-10-2 13:53:20]
# 1

The code your posted is an Applet. Applets are supposed to be run from a browser and HTML code. You can not run an applet from the command line using "java HappyFace" because java.exe is a Java Application launcher. Your book should have the HTML code that goes with this Applet and it should describe how to run it either from a browser or from appletviewer.

atmguya at 2007-7-13 11:55:48 > top of Java-index,Developer Tools,Java Compiler...
# 2

The book doesnt actually say the only thing it says is "typically the graphics is displayed inside of an applet." then it blabbers on that the next chapter (chapter 2)uses graphices as part of the window interface other than an applet. chapter 13 covers applets & html but hell thats along way away. these graphics supplements are at the end of each chapter and it says it is optional if you wish to cover them now or later....but being a dummy on java i thought its best not to miss a page...

however looking at this book it displays the window and a i can see something called applet viewer: happyFace.class... so then can you explain how this goes... do i have to download this applet viewer and exicute it from within that or will JCREATOR reconise that there is an applet viewer on my system and i can still run it from the gui within jcreator....i have no idea....i guess things will came together as i read further on...

Alexander_Zohara at 2007-7-13 11:55:48 > top of Java-index,Developer Tools,Java Compiler...
# 3
Hey!! i have the same problem... I have JCREATOR and Im trying to do applets too... I get the same error... Hey Savitch... I use savitchin.java as my input thinggy... Cool... If you find out anything please e-mail me don't repostISOtuxracebgallaghe@gmail.com~thanks
ISOtuxracea at 2007-7-13 11:55:48 > top of Java-index,Developer Tools,Java Compiler...
# 4
AlexHow can I contact you?Ori
OriLahava at 2007-7-13 11:55:48 > top of Java-index,Developer Tools,Java Compiler...