These are the instructions that came with my copy of CodeWarrior
for Java. I have built applications on the Mac using CodeWarrior
at home. Please let me know if you have any problems in running
the Hello World test program.
Launch the CodeWarrior IDE: Click the Start button and select CodeWarrior
IDE.
Create a project using CodeWarrior Stationery:
Choose the File > New menu item. The New window appears with a list
of options in the Project tab.
Enter information in the Project pane:
Select "Java Stationery" from the Project pane on the left side of the
window.
In the Project name edit field field, type a project name and add the
".mcp" extension (e.g. "HelloWorld.mcp"). It is the standard extension used
by Metrowerks for CodeWarrior project files.
Finally specify a location for the project. To specify the folder where
the project file should be saved, click Set and use the standard file dialog
to save your project.
Click OK to continue.
Select a project stationery in the New Project window
Expand the "JDK 1.2" list control and choose the "Java Application"
project stationery.
Click OK to continue.
CodeWarrior IDE creates a project with all the required libraries
and the project window appears.
Remove the place holder source file from the project:
To remove the file TrivialApplication.java from the project click the
list control next to the Source group (the + sign).
Click the file TrivialApplication.java in the Project window.
Choose Edit > Delete.
Click OK in the next dialog box.
Create a blank text file:
Press Ctrl-N to create a blank text file (or click the document icon in
the toolbar, which is the left most icon in the toolbar). An untitled, empty
editor window appears.
Enter the sample code:
/* A Java Hello World Console Application */
public class Hello {
public static void main (String args[]) {
System.out.println ("Hello World!");
}
}
Save the source file
To save the source file, press Ctril-S (or choose File > Save).
When the Save document as dialog box appears, name the source file Hello.java
and click Save. The .java extension enables the CodeWarrior IDE to recognize this
file as a source code file.
Add the file to your project
With the editor window frontmost, choose Project > Add Hello.java to Project.
The Add Files window appears. Use this window to specify which build targets
should use the Hello.java file. If you want to add the file to all targets (in this
example we do) click OK.
Choose Edit > Java Application Release Settings to display the Target Settings
window.
Click Java Target on the left side of the Target Settings window to display the
Java Target settings panel.
Change the Main Class to Hello.
Click Save to save your settings.
Close the Target Settings window.
The IDE uses groups to organize your code. To move your new source file, click the
file Hello.java and drag it on the Sources group in the Project Window.
Compile, link, and run the example
Choose Project > Run. The console project is compiled, linked, and run.