Chapter 2 - Getting Started

Retrieving the necessary software

The below software is some of the products and utilities available for the Macintosh platform and others. You will need a development platform that includes a compiler and viewer to use the Java language. To view applets inside a webpage, you will need to download a web browser that includes Java support such as Netscape Navigator 3.0.

Sun Java Development Kit 1.02
The Sun JDK is a simple environment that includes a drag-and-drop compiler, applet viewer, and plenty of samples. It is free and makes a good solution for beginners or simple projects.

Netscape Navigator 3.0
The 3.0 version of Netscape is still in beta but provides the best browser with Java support. Always make sure you have the latest version.

PowerProduction WebBurst
PowerProduction has released WebBurst which is a Java development environment for non-programmers. It features a simple drag-and-drop interface to create powerful applets without making the user code a single line of Java.

Symantec Cafe
Cafe is a full featured development environment that includes a compiler, debugger, disassembler, viewer, and more. It also includes a visual tool to help create user interfaces without as much coding.

Metrowerks CodeWarrior
Metrowerks has added Java to its popular CodeWarrior package which includes C, C++, Pascal, and more. The company has also released a product called Discover Java which is similar to the full featured CodeWarrior package but only supports the Java language.

Natural Intelligence Roaster
Roaster was the first Java development kit released for the Macintosh and is another full featured package. Apple has licensed the technology behind Roaster to fold it into the MacOS.

Other development environments and browsers are going to be released soon. For the latest information visit the Apple Flavored Java home page.

Working with the MacJDK and Netscape Navigator?

The Macintosh Java development kit supplied by Sun Microsystems and Javasoft is a simple development environment to produce Java applets. It contains the Java compiler, a simple applet viewer, API documentation, and a host of sample applets. Look through some of the examples to get a feel for how the applet viewer and Java compiler operate. The easiest way to view an applet is to drag the HTML file that contains the embedded Java applet on top of the applet viewer and drop it. The applet viewer will be launched and the Java applet contained in the HTML file will be loaded. You can also select Open LocalÉ from the File menu to open an HTML file from your disk or Open URLÉ to open a remote HTML over the Internet. Be warned that in its current release the applet viewer only recognizes <applet> tags that are lowercase. This means that some examples that use <APPLET> or <Applet> will not display properly. Note that the applet viewer will just display the embedded applet and not the surrounding HTML page.

The Java compiler works much in the same way as the applet viewer. Java source files that end in .java can be dragged on top of the Java compiler which will compile the code and write a .class file into the same directory. This class file is the applet code that you will embed into your HTML documents using the <applet> tag. You must name the file with the same name you use in the class declaration.

Applets can also be viewed with the Netscape Navigator application. Netscape is probably a better choice for final viewing of applets because it also displays the HTML page around the running applet. If you recompile an applet, Netscape will not reload the new class file when you press the reload button or choose reload from the menu bar. You need to quit and restart Netscape or change the URL for it to load the new class file properly.