Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to run an applet with appletviewer

 
Tony Pearce
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to run any applets using appletviewer. This code is from the book "SAMS Teach Yourself Java in 24 hours".
This is the environment as shown by the MS-DOS SET command:
CLASSPATH = .;D:\jdk1.3.1\lib;D:\jdk1.3.
\lib\tools.jar;D:\jdk1.3.1
PATH=D:\jdk1.3.1\bin;%PATH%;
This is the source code (Downloaded from http://www.java24hours.com/):
import java.awt.*;
public class RootApplet extends javax.swing.JApplet {
int number;
public void init() {
number = 225;
}
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D) screen;
screen2D.drawString("The square root of " +
number +
" is " +
Math.sqrt(number), 5, 50);
}
}
The compile generates no errors, but this is the result when I run it:
D:\SamsJava>appletviewer RootApplet.html
Exception in thread "main" java.util.MissingResourceException: Cant find
resource for bundle sun.applet.resources.MsgAppletViewer, key
appletpanel.badattribute.exception
at java.util.ResourceBundle.getObject(ResourceBundle.java:382)
at java.util.ResourceBundle.getString(ResourceBundle.java:354)
at
sun.applet.AppletMessageHandler.getMessage(AppletMessageHandler.java:42)
at sun.applet.AppletPanel.showAppletStatus(AppletPanel.java:697)
at sun.applet.AppletPanel.init(AppletPanel.java:185)
at sun.applet.AppletViewer.<init>(AppletViewer.java:175)
at
sun.applet.StdAppletViewerFactory.createAppletViewer(AppletViewer.java:81)
at sun.applet.AppletViewer.parse(AppletViewer.java:1035)
at sun.applet.AppletViewer.parse(AppletViewer.java:969)
at sun.applet.Main.run(Main.java:140)
at sun.applet.Main.main(Main.java:82)

Is anyone able to shed some light on this?
I have re-installed jdk1.3.1 but that made no difference.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic