This Web page is an electronic companion to the book Learning to Use the World Wide Web, by Ernest C. Ackermann . It contains links to the Internet resources, sites, and services mentioned in the text.
Please send any comments, questions or suggestions to the author at ernie@paprika.mwc.edu .
 

Java Applets and JavaScript


Overview of Java, Java Applets, and JavaScript

Java was developed by Sun Microsystems. Lots of information is available at the Java home page

A Java applet is a Java program that's constructed using the class applet and the abstract windows tool kit. An applet is included in a Web page using the HTML tags

 <Applet ..specifics about an individual applet>          </Applet>

The programs are first written in Java, compiled or translated to byte codes using a Java compiler, and when a Web browser retrieves a page with the Applet tag, the byte codes are sent to the computer viewing the Web page to be executed there.

"The WDVL: Introducing Java(TM) - Your First Applet" by Diana Luckevich for the Web Developer's Virtual Library provides an introduction to Java applets.

Netscape Navigator, starting with version 2.0, includes an interpreter (part of the browser software) that will interpret and execute instructions written in a language called JavaScript. These instructions are part of the Web page and are translated or interpreted by the browser on the client system. JavaScript includes several of the features of Java but is meant to be easier to use and develop applications. JavaScript has objects and methods that are used to develop interactive applications as part of Web pages.

Netscape Communicatons Corporation developed JavaScript and provides JavaScript Guide and JavaScript Reference.


Here's a summary of Java, Java Applets, and JavaScript and how they're used.
Java: Programs are written in Java and then translated to byte codes by a Java compiler. The byte codes are architecture-neutral in the sense that they can be executed on any computer that has a Java interpreter. The interpreter is part of the software making up Navigator 2.0. A compiled Java program (byte codes) can be transferred from a server to a client through a Web browser and the program is then executed on the client's computer. Since Java is an object-oriented language, its features and capabilities make Java a modern, useful, and high-performance language.
Java Applet: An applet is compiled or translated into byte codes and made available to a Web browser through the use of the tag in HTML The code is downloaded from it's source location by the browser. After the code arrives it is interpreted by the computer using the browser, the client, and executes there. In order to include an Java applet on a Web page you either have the applet in the same directory as the Web page or include a URL to the directory that holds the applet.
JavaScript:A script can appear to be very much like a program, but the script is part of a Web page. It isn't translated first like a Java program. The script is part of the source for the Web page.

Using Applets

Sun Microsystems, the developers of Java, maintain the primary Web page for information about the language, http://java.sun.com, and a collection of Java applets. A large collection of applets is maintained by developer.com at http://www.developer.com/directories/pages/dir.java.html

The book contains some examples of using applets on a Web page including Java Applet and JavaScript Demo, at http://www.webliminal.com/java/wwwdemo.htm.

Another example to look at is Clock, That's part of the collection of applets at the Sun Java site.

Using JavaScript

Some JavaScript tutorials on the World Wide Web

The book contains some examples of using applets on a Web page including Java Applet and JavaScript Demo, at http://www.webliminal.com/java/wwwdemo.htm. Another is Some Quick JavaScript Examples at http://www.webliminal.com/java/jsquick.htm

Loading a Web page in Netscape Navigator creates a number of objects related to the page and its contents. You can access these objects through JavaScript. Take a look at Netscape's document Navigator Object Hierarchy for more information.

Here's a link to a workshop I presented in March 200. It has more informaiton about JavaScript applications.


Writing Java Applets

Some pertinent documents

The Java language system is distributed as the Java Development Kit (JDK). It has everything you need to write and compile applets, and contains several demonstration applets. You may want to look at Setting Up and Using the Java Developer's Kit. A detailed set of instructions for installing the JDK on a Windows 95 computer system, written by Phil Filner.


Information, Tutorials, and Examples on the WWW

Java Language and Java Applets

JavaScript

I really like this book!
Designing With JavaScript : Creating Dynamic Web Pages by Nick Heinle
O'Reilly & Associates; ISBN: 1565923006.

Changes/corrections to the most recent version of the book.
Some other places you may want to visit
Internet Today! Email, Searching & the Web Learning to Use the Internet Learning to Use the World Wide Web Searching and Researching on the World Wide Web

FROM the fortune list ...

The web of our life is of mingled yarn, good and ill together. - Shakespeare