1 | Applets should NOT have main method but rather init, stop, paint etc. |
2 | They should be run through javac compiler getting a .class file as before |
3 | Create an HTML file (say HelloWorld.HTML in same directory as .class file) and include in this |
4 | <applet code="Example.class" width=500 height=200 > </applet> in simplest case with no parameters where applet will run in window of given width and height (in pixels) |
5 | If you have JDK on one's machine, one can run the applet with appletviewer HelloWorld.html |
6 | Alternatively run Netscape 2.0 essentially anywhere and applet is interpreted and run by Java interpreter built into Netscape. |
7 | This way we can compile on places with JDK installed but run almost anywhere! |