Java Applets and the Internet

The idea here is simple: Users will download Java bytecodes from the Internet and run them on their own machines. Java programs that work on web pages are called applets.To use an applet, you only need a Java-enabled web browser, which will execute the bytecodes for you. You need not install any software. Because Sun licenses the Java source code and insists that there be no changes in the language and standard library, a Java applet should run on any browser that is advertised as Java-enabled. You get the latest version of the program whenever you visit the web page containing the applet.Most important, thanks to the security of the virtual machine, you need never worry about attacks from hostile code.

1.3 Java Applet与Internet


When the user downloads an applet, it works much like embedding an image in a web page. The applet becomes a part of the page, and the text flows around the space used for the applet. The point is, the image is alive. It reacts to user commands, changes its appearance, and sends data between the computer presenting the applet and the computer
serving it.


Figure 1–1 shows a good example of a dynamic web page that carries out sophisticated calculations. The Jmol applet displays molecular structures. By using the mouse, you can rotate and zoom each molecule to better understand its structure. This kind of direct manipulation is not achievable with static web pages, but applets make it possible. (You can find this applet at

【Core Java】【Volume I ~Fundamentals】【Chapter 1】【1.3】【Java Applets and the Internet】_字节码 

图1-1展示了一个很好的动态网页的示例。Jmol applet显示了分子结构,这将需要相当复杂的计算。在这个网页中,可以利用鼠标进行旋转,调整焦距等操作,以便更加细致地理解分子结构。用静态网页将无法实现这种直接的操作,而applet却可以达到此目的。(可以在http://jmol.sourceforge.net上找到这个applet)

When applets first appeared, they created a huge amount of excitement. Many people believe that the lure of applets was responsible for the astonishing popularity of Java.However, the initial excitement soon turned into frustration. Various versions of Netscape and Internet Explorer ran different versions of Java, some of which were seriously outdated. This sorry situation made it increasingly difficult to develop applets
that took advantage of the most current Java version. Today, most web pages simply use JavaScript or Flash when dynamic effects are desired in the browser. Java, on the other hand, has become the most popular language for developing the server-side applications that produce web pages and carry out the backend logic.

当applet首次出现时,人们欣喜若狂。许多人相信applet的魅力将会导致Java迅速地流行起来。然而,出气的兴奋很快就淡化了。不同版本的Netscape与Internet Explorer运行不同版本的Java,其中有些早已过时。这种糟糕的情况导致更加难于利用Java的最新版本开发applet。今天,当需要在浏览器中显示动态效果时,大多数网页都直接使用JavaScript或Flash。另外,已经成为用来开发服务器端应用程序的最流行的语言,使用这些服务器端应用程序可以产生网页、运行后端逻辑。