JavaScript Isn't JavaDespite the name, JavaScript and Java have almost nothing to do with one another. Java is a full-featured programming language developed and marketed by Sun Microsystems. With Java, a descendant of the C and C++ programming languages, programmers can create entire applications and control consumer electronic devices. Unlike other languages, Java holds out the promise of cross-platform compatibility; that is, a programmer should be able to write one Java program that can then run on any kind of machine, whether that machine is running Windows, Mac OS X, or any of the different flavors of Unix. In practice, Java hasn't always realized that dream, due in no small part to bickering between Sun and Microsoft as to the direction of the language. Microsoft got involved because it first wanted to integrate Java into Windows in its own way (a way that Sun said would make Java work one way on Windows, and another way on other machines, thereby defeating Java's main purpose); then Microsoft dropped Sun's Java from Windows altogether, after creating its own Java-like language, C#. After a flurry of lawsuits between the two companies (and a big settlement in favor of Sun), Microsoft removed its Java from Windows, and you can now install the latest version of Sun's Java for Windows (or Linux) at http://www.java.com/getjava/. Mac OS X comes with Java installed as part of the operating system. Besides standalone applications, Java's main use on the client side, that is, in the user's browser, is to create applets, small programs that download over the Internet and run inside Web browsers. Because of Java's cross-platform nature, these applets should run identically on any Java-enabled browser. In recent years, we've seen many Java applets for browsers replaced by Macromedia Flash animations, which are generally easier to create than Java applets. You embed Java applets in your Web pages using the <object> HTML tag, with additional information specifying the applet. When the browser sees the <object> tag, it downloads the Java applet from the server, and the applet then runs in the area of the screen specified in the tag (Figure 1.1). Figure 1.1. This Java applet plays a mean game of checkers.To learn more about Java, we recommend Java 2 for the World Wide Web: Visual QuickStart Guide by Dori Smith. |