next up previous
Next: JavaScript Up: Some Specific Web Technologies Previous: PERL4 and PERL5-CGI Scripts

Java and Its Use on the Web

Java is an object-oriented language that has similarities to C and C++. Its introduction, in 1995, had a major impact on the Web, as it allowed one to incorporate customized computer programs on the client (Web browser) side, as shown in the complicated Figure 3. Thus, Java, for the first time, allowed one to build balanced client-server applications. Note, Figure 5 points out that there is substantially more compute capability on clients than servers. Further, any server-based system is likely to have nontrivial latency (delay in response) and so Java can be used to build user interfaces where many relatively simple computations are involved, and the low-latency client-side approach is clearly preferable. However, Java is turning out to be of even greater importance than these Web architecture issues suggest. In particular, one expects it to challenge C++ and Fortran ([Fox:97e]) as the future language of choice for software engineering and scientific computation, respectively. This trend is due to a variety of reasons. For instance, the WebWindows approach suggest future large software engineering projects will build to Web standards, which implies Java will often be a natural implementation language. Again, Java offers an attractive object-oriented environment with the potential of optimizing Java compilers being able to generate comparable performance to Fortran. Further, we can expect a growing trend to learn Java as a first language, as children are exposed to it from Web browsing and find using Java to enhance their home pages as an inducement to learn programming at school. These positive indicators are tempered by the immaturity of technology, which is only to be expected, but implies today (1997) that one should use traditional languages to build robust high-performance languages.

Java is used on the Web in a semi-interpreted mode shown in Figure 17. Here, the javac compiler converts Java language (java) into JavaVM (class files), which can be thought of as universal machine code. The JavaVM files and libraries are downloaded as needed from the server to client. At the client, the ``bytecodes'' of the JavaVM are interpreted, checked for security issues, and converted to native machine code.

  

Figure 17: Structure of Interpreted Java Applets

Java comes with a powerful runtime that is aimed in particular at the graphics, networking, and user interface features that one needs for interactive Web pages. There is, in particular, a comprehensive AWT (abstract windowing toolkit) that supports such things as buttons, forms, windows, and their layout.

In Figures 18 and 19, we give, respectively, the Java source, and invoking HTML page that will display ``Hello World!'' Note this uses built-in (runtime) classes, Applet and Graphics.

  

Figure 18: The Java Code for the Simplest Java Applet: Hello, World!.

  

Figure 19: Displaying Your Hello World Applet from a Web Page

We can expect Java technology to improve in many ways that will increase its performance and functionality. We will see better ``Just in Time'' compilers--essentially, clever interpreters of JavaVM that generate reusable compiled code on the fly. We will see a wide variety of new libraries (runtime) supporting areas as diverse as commerce and scientific computing. Again, as well as the self-distributing software model of Figure 17, one will see native Java compilers that will get high performance by direct compilation of the Java language into the native machine code for particular machines.


next up previous
Next: JavaScript Up: Some Specific Web Technologies Previous: PERL4 and PERL5-CGI Scripts

Geoffrey Fox, Northeast Parallel Architectures Center at Syracuse University, gcf@npac.syr.edu