|
A Brief Introduction to Java Unlike JavaScript, Java is a full-fledged progamming language, one that has been in the news quite a bit lately. Java is a "cross-platform' language. The promise is that a program written in Java can be run on any kind of computer operating system, unlike typical programs which must be written especially for Windows 95 or Mac or UNIX, etc. It is possible to write large programs in Java, but it is the smaller "applets" that provide functionality on Web pages. Also unlike JavaScript, the applet is not part of the HTML itself. Instead the HTML contains instructions for the browser to download the Java program from the server, which can then be run on the user's computer if the user has a Java-enabled browser. The program runs in the browser's Java Virtual Machine (JVM). The HTML looks like this: <applet CODE="watermessager.class" ALT WIDTH="300" HEIGHT="150"> This line tells the browser what the name of the applet is ("watermessager") and what size window to display it in. The browser must download the program and then run it. At the bottom of the browser window in the status bar the user will see "Starting Java," then "Watermessager initialized," then "Applet watermessager running." Users without Java-enabled browsers won't see anything on their screens.. The HTML often also includes instructions on which parameters to pass to the program. See the watermessager applet in action: Watermessager Most of the Java applets in use today are animations of one kind or another. But Java chat programs are quite common, as are things like digital clocks, etc.. A Java program can read from and write to files on the server from which it came, but it cannot read from or write to files on the user's computer. Sources of Java information and applets:
Back to Module Three
|