Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Applet Won't Initialize

843807Jan 24 2008 — edited Feb 7 2008
This is a modified version of a tutorial I've been working with. Code for Main.java:

import javax.swing.*;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame("Swing Paint Demo");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(300,300);
f.setVisible(true);
}
});
}
}

Problem is that when I try to load the applet into an html file:
<html>
<APPLET code="Main.class"></APPLET>
</html>

It doesn't load.

The file compiles and executes as a stand alone .jar, but when I try to run it as an applet it won't work.

I know I'm probably missing an easy step. I have already checked my IE7 settings and java is enabled. I have no problem with any other java applets, just the ones I make. haha. Thank you ahead of time.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2008
Added on Jan 24 2008
9 comments
505 views