Im learning java, and i build a simple applet...
I compiled it into *.class and now, when i run it, i got the following
error:
Exception in thread "main" java.lang.NoSuchMethodError: main
How can i fix this? the code of the applet is this:
import java.awt.*;
public class RootApplet extends javax.swing.JApplet {
int number;
public void init() {
number = 225;
}
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D) screen;
screen2D.drawString("the square root of " +
number +
" is " +
Math.sqrt(number), 5, 50);
}
}
I hope some1 can help me
Paul Hamaker - 28 Jun 2006 08:37 GMT
An applet is run through its HTML in appletviewer or in a plugged
browser.
You are trying to run it as a standalone, which can't be done if it's
just an applet.
http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789
lookup 2. Compile and run, 36.Stand-alone application.