Using CodeWarrior
Getting Started with take-home Quiz 2 (Summer 2001)
This example is intended to get you started with CodeWarrior. This
example assumes that you are working at the lab 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 Quiz 2. The QuizTwo.java
file has been provided for you on the course web site. You may also
find the General CodeWarrior Tutorial
with pictures helpful.
- Invoke CodeWarrior
- If working from CDF-PC, double click on the "Applications" folder
which will be showing on your desktop, and then double click on the
"CodeWarrior" icon.
- If working from home, select Start -> Programs -> CodeWarrior Pro 5
-> CodeWarrior IDE
- Create a new project
- To open a new project, select File->New...
- Click on Java Stationary
- Project name: QuizTwo
(Choose the name of the directory to contain your quiz 2 files.)
- Location: H:\java\QuizTwo
(Your files will be stored on the H: drive, within a folder
called java, and within a folder called QuizTwo. The
folder QuizTwo 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
Java Application (or you may find the Csc 1.1
stationary works better if you're working from CDF-PC), and click
on OK. This will bring up a QuizTwo.mcp window.
- Tell Java where the main method is
- Select Edit -> Java Application Settings...
- Click on Java Target (under the Target settings)
- Main Class: QuizTwo
(change this to the name of your class containing the main method).
- Click on Save, and then close the window by clicking the "x".
- 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 "Tutorial" link, and then click on "Take-home quiz 2",
and click on "QuizTwo.java". Then click "File->Save As..." from the
menu, click on the H: drive, then click the 'java' folder, and the
'QuizTwo' folder. Then click the Save button. (Notice that you
want to place the files in the folder specified in 'Location' above.)
- 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 on the H: drive.
- Include Java Files
- Click on Sources in the QuizTwo.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 QuizTwo.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 QuizTwo.java file will automatically be added to
Sources in your QuizTwo.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.
- If you used the Java Application stationary in step 2 above,
you will have a file called TrivialApplication.java in your
Sources folder. This file is created automatically by the Java
Application stationary, and can be deleted. Click once on
TrivialApplication.java to highlight it, and then press the
Delete key on your keyboard, and then click on OK.
- 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 QuizTwo project which you have just created,
double click on "My Computer", then the H: drive, then java,
then "QuizTwo", and then double click on "QuizTwo.mcp."
QuizTwo.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:\java\QuizTwo, and then you will open the QuizTwo.mcp file.
© Copyright 2001 Andria Hunter.