Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Applet isn't starting.  RSS feed

 
Quazi Irfan
Ranch Hand
Posts: 91
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run a simple Applet with the following code,

with the following command line :

But I am getting the following error,

and a Applet window pops up, and at the bottom of the window it says

I am following instructions from a book, and according to the book it should work, but it isn't.

What am I doing wrong?
 
Knute Snortum
Sheriff
Posts: 3603
86
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you start the appletviewer, are you cd'd to a place where the viewer can find SimpleApplet.class? The easiest thing would be to be in the same directory.
 
Quazi Irfan
Ranch Hand
Posts: 91
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:When you start the appletviewer, are you cd'd to a place where the viewer can find SimpleApplet.class? The easiest thing would be to be in the same directory.


Yes, I go to the folder where I have SimpleApplet.class. appletviewer program in on my ubuntu path. So I can essentially use the following appletviewer command to run the java file.

 
Knute Snortum
Sheriff
Posts: 3603
86
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't appletviewer need an HTML file?
 
Quazi Irfan
Ranch Hand
Posts: 91
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:Doesn't appletviewer need an HTML file?


The alternate to using a separate html file is to add the html content in the source file.

And I have tried using a separate html file, but result is the same. I get the similar error.

 
Knute Snortum
Sheriff
Posts: 3603
86
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, I just tried it on my system and it works. Did you use javac to compile the source file?
 
Anam Zahra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This applet is working fine on my machine. May be you are not saving this file with SimpleApplet name. So class not found exception is coming.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!