aspose file tools*
The moose likes Beginning Java and the fly likes appletviewer window never pop up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "appletviewer window never pop up" Watch "appletviewer window never pop up" New topic
Author

appletviewer window never pop up

Jenny raj
Ranch Hand

Joined: May 19, 2005
Posts: 57
import java.awt.*;
import java.applet.*;

public class HelloWorldApplet extends Applet {

// An applet that simply displays the string Hello World!

public void paint(Graphics g) {
g.drawString("Hello World!", 10, 30);
}

} // end of class HelloWorldApplet

This is the simple applet code that i try to ru

It compiles fine and also runs without any error but i don't see any applet window popping up

wat could be the reason

help me plz
thanks
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

How do you run it,
could you pls specify it..

A very silly mistake done by so many programmer is running Java Applet is like:::

java HelloWorldApplet

But this is not the way of running any applet..
Java provides a special Tool for running applet "appletviewer"..
what you have to do is
write a Sample.html file
Content of Sample.html file is:



and then place this file in the same directory as Class file....
and the at command line execute this command

[B][/B]


I hope this will work and this time appletwindow will pop-up.....
and if still if you have any concern then revert me back.



Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Jenny raj ,

And if you have run the applet same as above thread then just put down the

error message or atleast snapshot to the forum

That will may bring some notice to us....



Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
just extend JPanel, and then make a main class with a frame....

then see if it works, then upload with html...

-Justin-


You down with OOP? Yeah you know me!
Jenny raj
Ranch Hand

Joined: May 19, 2005
Posts: 57
Hey i am very sorry folks

it was a mistake on my part

i executed as appletviewer FirstApplet.java instead of appletviewer FirstApplet.htm

i made it correct and it is working

thanks dear ranchers
Ravindra Appikatla
Greenhorn

Joined: Apr 27, 2006
Posts: 4
hey jenny no problem even u can run it as appletviewer FirstApplet.java
u need to include the <applet .....></applet> tag code in java code commented.
Jenny raj
Ranch Hand

Joined: May 19, 2005
Posts: 57
yeah it works

thing is i missed to include <applet></applet> tag in the java source code
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: appletviewer window never pop up