Java on the Macintosh

How to Make a Package

  1. Open Codewarrior IDE and choose New Project from the File menu.

  2. Click on the arrow next to Java to display the submenu and choose Java Library.

  3. Click on the arrow next to Sources to open the Sources folder in the Project Window and then click on the sources folder.

  4. Add desired files by choosing Add Files from the Project Menu. Each file in the package must have as its first statement package name; where name will be the name of the package.

  5. Remove TrivialClass.java by selecting it and choosing Remove Selected Items from the Project menu.

  6. Go to Java Application Settings under the Edit menu, and then to Java Output (under Linker heading) and change the name to namePackage.jar, where name is the name of the package. (This is a suggested file name.)

  7. Save and close the Java Application Settings window.

  8. Choose Make from the Project menu. This will create the jar file for your package.

Using Your Package

  1. Open a project in the usual way.

  2. Every file which uses a class from your package must have near the beginning the statement import name.*; where name will be the name of the package.

  3. Add the jar file for the package to your project.

  4. If you are writing an Applet also keep a copy of the jar file in the folder with your other files for the project. You must also list the jar file in the html file. An example follows:
    <applet archive="AppletClasses.jar,simphyPackage.jar" code="RunPendulum.class" width=2 height=2>
    

  5. Continue as you normally would to complete your project.

Updated 20 September 1999.