Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

appletviewer window never pop up

 
Jenny raj
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just extend JPanel, and then make a main class with a frame....

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

-Justin-
 
Jenny raj
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah it works

thing is i missed to include <applet></applet> tag in the java source code
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic