ERROR:'Exception in thread "main" java.lang.NoSuchMethodError: main "
Hello Guys! I need some help in my code Im new in making java programming.here's is my problem i would like to run an applet but i got this line error "'Exception in thread "main" java.lang.NoSuchMethodError: main " i use command prompt it is ok to compile if i try to type D:\javac AnitaApplet.java but when i ll go to the next type like java AnitaApplet then i got the error..:mad:
my code is this..
Code java:
import java.awt.*;
import java.applet.*;
public class AnitaApplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("Jakjes Bakery",15,20);
g.drawString("Naga City",15,30);
g.drawString("Philippines",15,40);
g.drawString("Emailto:jjakjes@yahoo.com",15,50);
}
}
pls help me i want to understand more about programming in java. thanks!
Re: ERROR:'Exception in thread "main" java.lang.NoSuchMethodError: main "
You are trying to run an applet like an application. Applications require a main method, applets don't. Try running using appletviewer rather than java.
Re: ERROR:'Exception in thread "main" java.lang.NoSuchMethodError: main "
You compile it as applet, not as an application. Applications require a main method.
Also, usually I've seen people extend JApplet
It's a subclass of Applet.
JApplet (Java 2 Platform SE v1.4.2)
Re: ERROR:'Exception in thread "main" java.lang.NoSuchMethodError: main "
Quote:
Originally Posted by
javapenguin
You compile it as applet, not as an application.
Not exactly...the compilation is the same, but they run differenly, in this case it needs to be run as an applet
Re: ERROR:'Exception in thread "main" java.lang.NoSuchMethodError: main "
thank you for the reply.. my question is how do i run it using appletviewer and if theres a main how do i indicate it in my code?? please advice thanks!
Re: ERROR:'Exception in thread "main" java.lang.NoSuchMethodError: main "
Re: ERROR:'Exception in thread "main" java.lang.NoSuchMethodError: main "
ok thank for all advise now i see the diffences of running of apllication and an applet.. =) thanks alot!!^:)^^:)^^:)^^:)^