Java is strongly associated with the internet because of the fact that the first application program written in Java was HotJava, a web browser to run applets on internet.
Internet users can use Java to create applet programs and run them locally using a “Java-enabled browser” such as HotJava. They can also use a Java-enabled browser to download an applet located on a computer anywhere in the Internet and run it on local computer.
In fact, Java applets have made the Internet a true extension of the storage system of the local computer.
Internet users can also set up their web sites containing Java applets that could be used by other remote users of Internet.
the ability of Java applets to hitch a ride on the information Superhighway has made Java a unique programming language for the Internet.
In fact, due to this, java is popularly known as Internet Language.
Java and World Wide Web (WWW)
World Wide Web (www) is an open-ended information retrieval system designed to be used in the Internet’s distributed environment.
This system contains what are known as web pages that provide both information and controls. Unlike a menu-driven system where we are guided through a particular direction using a decision tree structure, the web system is open-ended. And we can navigate to a new document in any direction.
This is made possible with the help of a language called Hypertext Markup Language (HTML).
Web pages contain HTML Tags that enable us to find, retrieve, manipulate and display documents worldwide.
Java was meant to be used in distributed environments such as Internet. Since, both the Web and Java shares the same philosophy, Java could be easily incorporated into the Web system.
Before Java, the World Wide Web (www) was limited to the display of still images and texts.
However, the incorporation of Java into Web pages has made it capable of supporting animation, graphics, games, and a wide range of special effects.
With the support of Java, the Web has become more interactive and dynamic. On the other hand, with the support of Web, we can run a Java program on someone else’s computer across the internet.
Java communicates with a Web page with a special tag called <APPLET>.
From the above figure, we can see the following steps involves:
- The user sends a request for an HTML document to the remote computer’s web server. The web server is a program that accepts a request, processes the request, and sends the required document.
- The HTML document is returned to the user’s browser. The document contains the APPLET tag, which identifies the applet.
- The corresponding applet bytecode is transferred to the user’s computer. This bytecode had been previously created by the Java compiler using the Java source code file for that applet.
- The Java enabled browser on the user’s computer interprets the bytecodes and provides output.
- The user may have further interaction with the applet but with no further downloading from the provider’s web server. This is because the bytecode contains all the information necessary to interpret the applet.