• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Newbie's problem with applet

 
James Zhang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need help on this beginner's problem: I downloaded a simple applet called HelloSwingApplet.java from Sun's tutorial as well as the HelloSwingApplet.html. Here is the code from the HTML file:
...
<applet code="HelloSwingApplet.class"
width=400
height=50>
</applet>
...
I have the same class file in the same directory with the HTML file (the applet was compiled without problem). However, when the page is displayed with IE6, the applet is not shown at all. I moved the cursor over and there is a message on status bar saying "load: HelloSwingApplet not found".
I have tried several different ways, like packaging the class in a package, put the class in a jar file, etc, but none of the ways worked! Why exactly couldn't it find the class?!!!
Any suggestion or advice will be greatly appreciated!
--Jian
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bare IE6 won't be able to display the applet; you need to have the Java Plug-in installed. The version of Java that comes with Windows is terribly old -- six or seven years, at this point -- and it can't display anything that uses Swing.
 
K Duke
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I got that to run without any problems (using IE 6.0).
The original HTML file contained:
<applet code="HelloSwingApplet.class"
codebase="example-swing"
archive="applets.jar"
width=400
height=50>
</applet>
Compile HelloSwingApplet.java, and put the class file in the same dir as the HTML file.
Get rid of 'codebase' and 'archive' attributes.
<applet code="HelloSwingApplet.class"
width=400
height=50>
</applet>
It works! I tried it with the same Java file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic