I'm using Java SE 1.6 on Mac OS X 10.5.6. The code for my applet is as follows:
import java.awt.Graphics;
import javax.swing.JApplet;
public class HelloWorld extends JApplet {
public void paint( Graphics g ) {
super.paint( g );
g.drawString( "Hello World!", 25, 25 );
}
}
I compiled this to a .class file. The code for my HTML file is as follows:
<html>
<head>
<title>Hello World</title>
</head>
<body>
<applet code="HelloWorld.class" height="300" width="300">
Your browser is ignoring the applet tag.
</applet>
</body>
</html>
If I run the applet with appletviewer, it works fine. However, if I open the HTML file in a browser, a square appears for the applet space, but the applet doesn't load. (The "Your browser is ignoring the applet tag." doesn't appear either.) The browser status bar shows two messages: Applet HelloWorld notloaded and Loading Java Applet Failed... I tried the applet with Firefox 3.0.6, Safari 3.2.1, and Opera 9.6.3. None of them could load the applet.
If I try opening the HTML for one of the Java demo applets in /Developer/Examples/Java/Applets, it loads fine in all three browsers.
Is there something I'm missing here, in trying to get this simple applet to load in a browser?