How Applets and Applications Are Different

The difference between Java applets and applications lies in how they are run.

Applications are run by using a Java interpreter to load the application's main class file. This normally is done from a command-line prompt using the java tool from the SDK, as you have done since Day 1, "21st Century Java," of this book.

Applets, on the other hand, are run on any browser that supports Java. At the present time, this includes current versions of Netscape Navigator, Microsoft Internet Explorer, Opera, and Sun's HotJava browser. Applets also can be tested by using the appletviewer tool included with the Java 2 Software Development Kit.

For an applet to run, it must be included on a Web page using HTML tags in ...

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.