Project Setup Instructions for
Java SDK, Kawa, and Initial Code

Bergin and Tappert

  1. Download Java SDK (latest Version 1.3) and Documentation from http://java.sun.com/j2se/1.3/

  2. Download Kawa (latest Version) from JourneyEd.com

  3. In Kawa under Customize­Options, set JDK, Kawa, & Advanced Paths as below. This assumes that you have installed the JDK on drive C in directory jdk1.3. Adjust otherwise.

The JDK Paths tab:

 

The Kawa Paths Tab.

 

The Advanced Paths tab.

  1. Download initial project code (op2003-4.zip) from Prof. Bergin's site and unzip it.

  2. Download Junit32.zip from http://www.junit.org/ to give us a testing framework.  Unzip it and find the path to junit.jar.

  3. In Kawa create a new project by Project-New, give it a file name. Save the file in the same directory as the project java files. Add the source code files to the project.  Under Project-Classpath click on Add File and add junit.jar to the classpath. 

  4. In the Customize -> Project Root Options menu, set the Compilation Output Directory to a period and make sure the check box above the field is checked.

  5. In Kawa, right click on OrderEntry.java and click on Main Class which puts a red box around that module indicating that it contains the main class to run.  From the toolbar, click on Rebuild All and everything should compile without errors.

  1. From the Kawa toolbar, click on Run Java which should bring up the OrderEntry form.  Enter customer number “C5002” which should bring up the customer information as shown below.  This part works so close the OrderEntry form.

  1. Now right click on InvoiceTest.java and click on Main Class which puts a red box around that module indicating that it contains the main class to run.  From the toolbar, click on Run Java to get the message “OK (2 tests)” as shown below

10.  Finally, do the same for OrderItemTest.java to get “OK (2 tests)” and then SystemTest.java to get “OK (4 tests).”  Congratulations, you have successfully completed the setup and testing of the initial project code!

 

Possible Kawa Problems

 

1. Problem: I have a project, but the compile and run buttons are greyed out.

Solution: Make sure your project is "open". Right click on the project file and select open. Kawa can have many projects in its main window, but at most one can be open at a time.

Note that you can "delete" a closed project from Kawa, but it won't remove anything from your disk. Close the project by right clicking on its icon and choosing close. Then right click again and choose delete.

You can similarly remove a file from a project. The file itself won't be deleted from the disk, however.

2. Problem: I can compile ok, but it won't run at all.

Solution: Make sure that you have selected one of your files as the main file. Right click on the file you want to begin with. This file must have a class with a main function, of course. The desginated file will have a red box drawn around it in the project pane.

3. Problem: When I run I get a NoClassDefFound exception in main.

Solution: Either you havent set the Customize->Project Root Options properly or your project file (...kpx) is not in the same place as your java files. To move the kpx file first close and remove the project from Kawa. Then move the file manually, then choose Open Project from the Project menu and navigate to the kpx file in its new location.

The Root Options dialog should look like this:

Root Options Dialog

Set the period in the Compilation output directory option by clicking on the >> button and then typing a period in the Add/Edit field on the next dialog. Then click Add/Update there and Finally OK on that pane and then OK on this one.

4. Problem: I've got Junit installed, but I can't seem to compile the test code.

Solution. Make sure Kawa knows where to find Junit. The best way is to set the Project->Classpath option in Kawa as follows.

The above assumes, of course that this is where your junit really was installed. You need to substitute your own path. The easy way is to select New in this dialog and then AddFile. You can then navigate to the file and double click it.

Possible Project Problems not related to Kawa

1. Problem: When I run the program the database seems to be empty and the SystemTest fails with errors in InvoiceTest.

Solution. You may have reinitialized the database inadvertantly. Restore it either by re-extracting the initial test2.dat file from the zip archive or restore it from a previous maintaince backup.

2. Problem: I've changed one of the course project files and it compiles OK. However, when I run I get a message that the run "Failed restoring database" and an InvalidClass exception.

Solution: The database contains a certain signature of the class as well as the data objects. Before you can continue you need to either

  1. Deal with versioning (an advanced topic) on the live data. This requires you begin with the old version of the class, however.
  2. Restore the database from a previous maintaince backup. It is a good idea to have made this backup before you begin your class changes, however.