Monday, December 26, 2011

Executing an Applet

The Java compiler in the JDK will compile both applications and applets. However, java applet is not executed in the same way as an application. You must embed an applet in a web page before it can be run. You can then execute it either within a Java 2-enabled web browser, or by using the applet-viewer, a bare-bones browser provided as part of the JDK. It is a good idea to use the applet-viewer to run applets while you are learning. This ensures that if your applet doesn’t work, it is almost certainly your code that is the problem, rather than some problem in integration with the browser. If you have compiled an applet and included it in a web page stored as MyApplet.html in the current directory on your computer, you can execute it by entering the command:

appletviewer MyApplet.html

So how do you put an applet in a web page.

No comments:

Post a Comment

Thanks for Commenting......