|
Fundamental Programming Concepts
Summer 2000
|
|
Creating a Project
These instructions assume you are creating a project called Lab1 with a
single file called Lab1.java. For future labs, the name of the project and the
name(s) of the file(s) may differ. Throughout the instructions you'll find
hyperlinks to pictures that show how your screen should look after performing
the task right before the link. Use these to check that you're following the
instructions correctly.
- Start CodeWarrior. You can find this in Upson B7 on the Start menu:
Start->Programs->Class Files->CodeWarrior Pro 5->CodeWarrior
IDE.
- Start creating the project by going to the File menu and choosing
"New..." (not "New Text File").
- In the New dialog, click on "Java Stationery" on the left side.
Enter "Lab1" as the project name -- all one word, there should be
no space between Lab and 1. [picture]
- Still in the New dialog, set the project
location by clicking the "Set" button. Set the location in the
pulldown listbox to Desktop. [picture] Click on the "Save" button. Important:
since we set the location as the Desktop, you must copy it to a disk
before you logout from your computer. Otherwise it will be deleted! Click
on the "OK" button to close the New dialog.
- In the New Project dialog, find the "Java2" line. Click on the
'+' to the left of it, and four more lines will appear. Select "Java
Application" and click OK. [picture] The project has now been created,
but there's a couple things we still need to do to customize it for this
lab. You'll now have a project window on your screen, which will have a title of "Lab1.mcp" (mcp
stands for Metrowerks Compiler Project). Don't close this window until
you're done working on your program! As far as Metrowerks is concerned, it is
your program.
- In the Project window, click on the '+' to the left of
"Sources". This should expand to show a new line with the name of
a file -- "TrivialApplication.java". [picture]
This is a dummy file that
Metrowerks has put in the project, and we need to get rid of it. To do so,
select the file's name, and press the "Delete" key on the
keyboard. Answer OK to the next dialog, and the file will be removed from
the project. It should no longer appear under "Sources". [picture]
- Now we need to add the real source file for the lab --
"Lab1.java". To do so, again go to File->New. This time, click
on the "File" tab and select "Text File". Enter
"Lab1.java" as the file name (remember, capitalization is
important! -- and again, no space between Lab and 1). Then check "Add to project", and check "Java
Application". [picture] Click OK, and the file will be created and added to the
project.
- Finally, go to the Edit menu and choose "Java Application
Settings". On the left side of the Settings dialog, find "Java
Target" and click on it. Find the "Main class" field on the
right side. It should have "TrivialApplication" in it. Change it
to "Lab1". [picture] Click "Save", then close the dialog
by clicking the X at the top right corner.
That may seem like a lot, but since you'll be doing it for every program you
write, you'll get used to it.
Don't forget -- when you're done working on a program, close Metrowerks, and
then copy the project's folder from the Desktop to a disk. If you don't save it,
you'll have to do all your work over again!
When you want to work on the program again, you can use Metrowerks to open
the project file (e.g., "lab1.mcp").