Using CodeWarrior
Getting Started with Assignment 0 (Fall 2000)
This example is intended to get you started with CodeWarrior. This
example assumes that you are working from CDF-PC on campus. It
explains how to save the Java code files that are given to you on the
course web site on the hard drive, and then how to work on your copy of
the files from within the CodeWarrior environment.
We'll assume that you want to get started with Assignment 0. The
AssignmentZero.java file has been provided for you on the course
web site.
- Get your own copy of the files
- For many of the assignments in CSC108, you will be provided with
one or more Java program files, which you will need to modify as
outlined in the assignment description. These files are available
from the course web site. You need to get your own copy of these
files and to put them on the H: drive (although you are probably used
to using the C: hard drive at home, on campus you should save your
files on the H: hard drive).
- Start up Netscape and go to the course web site web page. Click
on the "Assignments" link, and click on "Starter Code" in the
Assignment 0 section. Then click "File->Save Frame As..." from
the menu, click on the H: drive and then click on the Save
button. (Note that you may want to organize your files on the hard
drive by putting this file into a folder for A0 on the H: drive.)
- The remainder of the steps can be done within the CodeWarrior
environment. You'll be working on the copy of the Java file that you
have just placed in your home directory (the H: drive).
- Invoke CodeWarrior
- Double click on the "Applications" folder, and then double click
on the "CodeWarrior" icon.
- Create a new project
- To open a new project, select File->New...
- Click on Java Stationary
- Project name: Asst0
(Choose the name of the directory containing your assignment 0 files.)
- Location: H:\Asst0
(H: is the hard drive where your files are stored, and the
folder Asst0 has to be the same as your project's name.)
Then click on OK.
- Click on the "+" next to Java2 to open it up, and then select Csc
1.0, and click on OK. This will bring up a Asst0.mcp window.
- Tell Java where the main method is
- Select Edit->Java Application Settings...
- Click on Java Target (under the Target settings)
- Main Class: AssignmentZero
(change TypeYourMainClassHere to be the name of your class
containing the main method).
- Click on Save, and then close the window by clicking the "x"
in the top right corner.
- Include Java Files
- Click on Sources in the Asst0.mcp window to highlight it.
This ensures that the Java files you add will be put into
the Sources folder.
- With Sources highlighted, select Project->Add Files... and
click the AssignmentZero.java file (which is wherever you saved
it from the web page on the H: drive) and click on "Add." If you
had more files to add, this process could be repeated to add each
file.
- Your AssignmentZero.java file will automatically be added to
Sources in your Asst0.mcp window. If you don't see a "+" next to
Sources, click on the various tabs in this window (Files, Link
Order, Targets) to cause it to refresh.
- Click on the "+" next to Sources, and you will see the files that
are part of this program. Double click on one of your ".java"
files to bring up a window that will allow you to view or edit it.
If you make any changes to a file, be sure to save them by
clicking on File->Save.
- Compile
- Select Project->Make. Any compile errors will come up at this
time. They will indicate the line number that has a problem.
- Run
- Select Project->Run. The output will come up in an MS-DOS
window. Any input for the program would be entered here. It
will instruct you to press Enter in this window when the program
has finished.
- Closing CodeWarrior
- Select File->Exit to leave CodeWarrior. Your project will be saved.
- Reopening a Project
- To reopen this Asst0 project which you have just created,
double click on "Home Directory (H:)," double click on "Asst0,"
and double click on "Asst0.mcp." Asst0.mcp stores all the
information about your project.
- Alternatively, you could have started up CodeWarrior as in step
2, and then you would select File->Open... An Open window will
pop up. You will change the directory in this window until you
get to H:\Asst0, and then you will open the Asst0.mcp file.
© Copyright 2000 Andria Hunter.