University of Toronto - Spring 1999
Department of Computer Science

CSC 324 - PROGRAMMING LANGUAGES


Java Packages in JWS:

We've been getting reports that the instructions don't work for everyone; some of you report an error that looks something like
        fastjavac: Destination
        '/homes/u2/csc97g/g7foo/jws/A1/csc324/driver/~/jws/A1' is not a
        directory
There are a few fixes; one that seems fairly easy is the following (thanks to Ray Ortigas for writing this up):
If you followed the instructions on the CSC324 web page, you will notice that
the directories you specified started with "~".  In UNIX, "~" is the short
form for your home directory. It may be that JWS is not recognizing this
short form correctly in some cases, which may explain the error message
above.

A possible solution (that worked for at least one student): don't use the
short form. Wherever you see "~", replace it with the long form of your home
directory, e.g.:

        /homes/u2/csc97g/g7foo

If you are unsure what this long form is for you, enter

        cd

at the UNIX shell prompt to change the current directory to your home
directory. Then enter

        pwd

to print the current directory (your home directory). This should output
something like:

        /homes/u2/csc97g/g7foo

With that, on to the instructions:
Start jws.
Go to the main Java WorkShop window.
Select Windows->Project Manager
Select File->New->Project
In the Create Project window, name the project something like "A1".
Click Standalone and No GUI.
Click Next>.
The directory shown should end in jws/A1, and there are no files in
that directory that should be added.
Click Finish.  The Create Project window will disappear.

Select File->New->Subproject.
Name the project "csc324".
Click Package
Click Next>
Package name: csc324
Root directory: ~/jws/A1
Project source files should go in: ~/jws/A1/csc324
There are no files in that directory that should be added.
Click Finish.  The Create Project window will disappear.

Select File->New->Subproject.
Name the project "driver".
Click Package
Click Next>
Package name: csc324.driver
Root directory: ~/jws/A1
Project source files should go in: ~/jws/A1/csc324/driver
There are no files in that directory that should be added.
Click Finish.  The Create Project window will disappear.

Now put Driver.java in the directory ~/jws/A1/csc324/driver.

Select File->Add->File
Select Driver.java

Just a bit more:
Double-click on the A1 package in the Project Manager.
Select Project->Edit.
Click the Debug/Browse tab.
Change the Main Class to csc324.driver.Driver.
Click the Run tab.
Change the Main Class to csc324.driver.Driver.
Click Apply, then OK.

Now you're set.

To compile, select Build->Build All.

To run, you need to have the project A1 selected in the Project
Manager -- double-click on it to make sure.  In the main Java WorkShop
editing window, the green triangle should now be available, or to
Debug you can choose Debug->Start/Restart.


To add other packages and subpackages to the project, follow the above
directions, modified appropriately.  In the Project Manager, make sure
you have selected the correct project to hang your new package off of;
for example, to make a new package csc324.blerg, make sure that the
csc324 project is selected when you choose File->New->Subproject.