Metrowerks CodeWarrior Pro 5 is installed in the lab. The TAs and proctors can help you with using it. You can also purchase CodeWarrior for about $80. If you install CodeWarrior at home you still need to install the Java SDK which should come on the compact disk. You can also obtain the Java SDK directly from Sun. CodeWarrior Pro for Windows version 5 and 5.3 work best with the Java SDK version 1.2.2. I have had reports of problems when people tried to use the newest version of the Java SDK, version 1.3 with these versions of CodeWarrior. If you are planning on buying and using CodeWarrior at home be aware of these.
You can also download Java from Sun and BlueJ, but they are very large files and I offer you somewhat less assistance with the Java SDK / BlueJ combination. The upside however is both of these are FREE and you can work at home.
Creating projects. This page contains instructions for creating projects using Metrowerks CodeWarrior Pro for Windows, release 5 or 5.3 (the version of the software installed in the Elements Labs on campus).
CodeWarrior won't just run a Java program. It requires that you create a "project" first. This is sufficiently involved that projects will be provided in the lab. If you work only in the lab, you won't need to read further. You will need these instructions only if you want to use CodeWarrior outside the lab.
There is some help on this topic. To see it, click the Help menu, IDE topic. In the box, click "Create new projects"; in the new box, click "from Stationery". But the on-line help is incomplete and sometimes simply wrong, so try the following instead.
The following creates projects using Java Stationery. When you get to the point where you choose Java Stationery, you will see four other choices. I have tried them all and prefer Java Stationery. You may wish to experiment with the others, especially the Java Application Wizard — it may be simpler, but it creates 225 kbytes of files for an empty project.
Each project will contain several files and subdirectories (all but one created automatically by CodeWarrior), so it will need its own directory. I recommend creating one directory in which all project directories will be created. I will refer to this directory as the projects directory. It can be any directory you choose. In the Elements Labs, the projects directory is C:\cs303e\.
Creating a new project.
Setting up the new project.
The new project contains a source file TrivialApplication.java containing a class TrivialApplication. Both these names need to be changed.
Now we need to tell CodeWarrior that name, not TrivialApplication, is the main class.
Now delete the original source file TrivialApplication.java.
The ConsoleReader class from the Horstmann book and any other classes you will use need to be placed on your hard drive in a convenient directory so that your program can use ConsoleReader methods. I suggest that you create a directory named classes in the jdk directory. You needed to download jdk when installing CodeWarrior. (I know all of this jdk and sdk stuff is confusing. The software you need from Sun to run Java used to be called the Java Development Kit or jdk. Starting with Java version 1.2 the name of the software you need from Sun to run Java was changed to the Software Development Kit or sdk.) The default location is \jdk1.2.2, but you can choose another location. I think this is the best place for the classes directory, but it may not be the only place. I will refer to this directory as the classes directory below.
Finally, the ConsoleReader.java file needs to be added to the project. This needs to be done for each new project.
You can add as many files as you want to a project using the above method.
That's it — the file name.java is ready to be edited and run.
These steps may seem daunting at first, but you will soon get used to the
sequence and not need to use these instructions again.