hiii
hii guys. my name is ram. iam new to this forum and an obsolute beginer with java.
iam reading java HTP(deitel). my doubt is
import javax.swing.JApplet;
import java.awt.Graphics;
publicclass welcomeappletextends JApplet
{
publicvoid paint(Graphics g)
{
g.drawString("welcome to java programming!", 25, 25);
}
}
while running this pgm i get an error: exception in thread main java.lang.nosuchmethoderror:" main.
plzz help me solve this pblm. u r very much welcome with ur suggestions and tips for me to learn java(u know guys nowadays java has b'come one of my nightmares..but iam determined to learn java) and also suggest me some good books/links etc..
The code you posted is an applet. Applets are run using a browser (or appletviewer). You can not run them as a java application, unless you write code to handle setting up the applet as an application.
When you run a java application, the JVM looks for a method named main. Since your applet does not a method named main, you got the error.
Here's a page with some online tutorials.
http://java.sun.com/docs/books/tutorial/
as for the tutorial i have seen many like this ...i don feel comfortable with all these(may be my method of study is the prblm) ..can u suggest me how to move on(or how u did when u started java) .
i don know ur level of skill with java..but i feel u r good in java..plzz suggest
thank u in advance
> thank u
>
> and u do it like this: " create a html file and
> compile it using appletviewer filename.html command"
> right?
>
You create source code and compile it just like you compile a java application. If you use the command line, then you use javac.
You need to create a html file with correct html.
You can run an applet using appletviewer filename.html.
> as for the tutorial i have seen many like this ...i
> don feel comfortable with all these(may be my method
> of study is the prblm) ..can u suggest me how to move
> on(or how u did when u started java) .
If online tutorial don't work for you, then I believe you will either need a tutor/mentor or it will take you a long time to learn. If you are proficient in another computer language, you may learn quicker. I am self-taught. I went through tutorials and wrote code. I am not a computer professional, so I am not expert with java and others may give you different suggestions.