Exercise 1: Creating a Project

This exercise shows you how to create the most common type of project in the Java WorkShop, an applet project. An applet is a Java program designed to run within a Web browser (as opposed to a standalone program, which is usually run from a command line). By creating a project, you organize the information for working with the applet in the Java WorkShop, including building, browsing, debugging, and running the applet.

Blink, the project you create in this tutorial, is a small applet that blinks text on and off, using different colors. You will create the project using an existing source file, Blink.java. This file was installed in your .jws/Blink directory when you installed the WorkShop.

  1. Check the Java WorkShop tool bar for the name of the current portfolio.
    If the Current Portfolio field does not appear on your tool bar, try enlarging the WorkShop window. If the current portfolio is not "personal," choose Portfolio => Choose => personal. If you do not have a personal portfolio, see Importing Your Personal Portfolio.

  2. Choose Project => Create => Applet.
    This action opens a display with five tabs, each representing a different type of project: Applet, Standalone Program, Java Package, Image, and Remote Applet. In this lesson, you will work in the Applet tab.

  3. In the Applet tab, type Blink in the Project Name field.
    Make sure you capitalize the "B" in Blink. Java is case-sensitive. The project name Blink is consistent with the source file name Blink.java, which follows the Java convention of initial capitalization.

  4. In the Source Directory field, enter the path of your Blink directory.
    The path depends on your HOME environment variable.

    For Solaris computing environments, enter your_home_dir/.jws/Blink

    For Windows NT and Windows 95 (in order of priority):

  5. Click Yes for Existing Sources.

  6. Click the Add All in Directory button (under the Sources list).
    The file name Blink.java appears in the Sources list.

  7. In the Main Class File field, enter Blink.class.
    The main class file is the .class file that extends the Applet class of the Java library.

    The run page is the HTML file that contains the instructions on how to run the applet in a Web browser. For this tutorial, you do not need to specify a run page.

  8. Click the Apply button.
    The words "Apply Succeeded" appear in the browser footer. The WorkShop opens the Portfolio Manager, which displays the projects in your personal portfolio. The Blink project is the current project and its name appears in the WorkShop tool bar. The current project sets the context for all tools in the WorkShop.

    In this example, you created the Blink project in the file Blink.prj in your Blink directory. When you create a project in the future, you can create it in any directory in your file system.

    If this is the first time you have run the WorkShop, your personal portfolio contains one other project, Checkers. Checkers is an applet project, which has been provided for you to edit, run, browse, and debug.

Next lesson:

Exercise 2: Building the Project