Java ScreenShot
     

Screenshot Core Java 2: Volume I - Fundamentals

Table of Contents
 1.  An Introduction to Java


Java 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 need a Java-enabled Web browser, which will interpret the bytecodes for you. Because Sun is licensing the Java source code and insisting that there be no changes in the language and basic library structure, a Java applet should run on any browser that is advertised as Java-enabled. Unfortunately, reality has been different. Various versions of Netscape and Internet Explorer run different versions of Java, some of which are seriously outdated. This sorry situation made it increasingly difficult to develop applets that take advantage of the most current Java version. To remedy this problem, Sun has developed the Java Plug-in, a tool that makes the newest Java runtime environment available to both Netscape and Internet Explorer (see ). 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 viewing the applet and the computer serving it. Screenshot-1 shows a good example of a dynamic web page that carries out sophisticated calculations, an applet to view molecules. 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 the applet at http://jmol.sf.net.)

Screenshot-1. The Jmol applet

Java graphics 01fig01.gif


Applets can be used to add buttons and input fields to a Web page. But downloading those applets over a dialup line is slow, and you can do much of the same with Dynamic HTML, HTML forms, and a scripting language such as JavaScript. And, of course, early applets were used for animation: the familiar spinning globes, dancing cartoon characters, nervous text, and so on. But animated GIFs can do much of the same. Thus, applets are necessary only for rich interactions, not for general web design. As a result of the browser incompatibilities and the inconvenience of downloading applet code through slow net connections, applets on Internet Web pages have not become a huge success. The situation is entirely different on intranets. There are typically no bandwidth problems, so the download time for applets is no issue. And in an intranet, it is possible to control which browser is being used or to use the Java Plug-in consistently. Employees can't misplace or misconfigure programs that are delivered through the Web with each use, and the system administrator never needs to walk around and upgrade code on client machines. Many corporations have rolled out programs such as inventory checking, vacation planning, travel reimbursement, and so on, as applets that use the browser as the delivery platform. At the time of this writing, the pendulum has swung back from client-focused programs to server-side programming. In particular, app servers can use the monitoring capabilities of the Java virtual machine to perform automatic load balancing, database connection pooling, object synchronization, safe shutdown and restart, and other services that are needed for scalable server apps but are notoriously difficult to implement correctly. Thus, app programmers can buy rather than build these sophisticated mechanisms. This increases programmer productivity—programmers focus on their core competency, the business logic of their programs, and not on tweaking server performance.

Screenshot

Java ScreenShot
     
Top
 

Comments