| Log In | Not a Member? |
Contact ADC
|
|
![]() |
|
|
| Previous Section | Table of Contents | Next Section |
Setting
Up the Project
|
As the picture (right) shows, the sources are organized logically in several folders:
|
|
Now lets open the project in CodeWarrior and examine it in detail. If you have CodeWarrior 5, you may double-click directly on the project file SlideShow.mcp. If you have an older version of CodeWarrior, you will need to use SlideShow(CW4).mcp instead.
All of the image resources are in a group called images, and library files are in a group called Classes. Before we start examining the source code, we will examine the project settings. Although this project is preconfigured for your convenience, we will examine the pertinent settings that would need to be configured if you were writing a Java application from scratch. To bring up the project settings dialog, either click on the project
settings button: |

|
The settings dialog should look like the picture above. If it does not, click on the Target Settings item in the left panel. Go to the edit field labeled Target Name, and change the text to SlideShow. This specifies the name of the output file. Make sure the Linker popup field reads Java Linker. CodeWarrior supports many different development languages, and Java is not the default, so we need to make sure that we are using the Java tools to build and link our project. The Pre-linker and Post-linker popup menus should be set to none. Now click on the Java Target item in the left pane. Your dialog should now look like this: |
|
The Target Type popup menu has three possible values. Library, Applet, and Application. Since our project is a stand-alone program, we choose Application. If we wanted our program to live in an HTML file inside of a browser, then we would choose Applet. We would choose Library if we wanted to make a file that contained some Java routines that we wanted to call from another source code base. Make sure that the Main Class text field contains the value SlideShow. This specifies that the Next, click on the Java Output item in the left panel. Your dialog should look like this: |

|
Make sure that Jar File is selected from the Output Type popup menu. Make sure that the Name field contains the entry SlideShow.jar. The jar format is a compressed format (if you check the Compress checkbox) similar to the .zip file format. It is a storage or archive format that accommodates a virtual hierarchical file structure that may contain both class files and resource files. Since our application has both of these file types, we use this format so that we can place all of our class files and resources in a single file on disk. Now that we have completed these settings, click the Save button and close the window by clicking on the close box in the upper left hand corner of the window. Our application uses classes from the MRJToolkit, and also classes from Suns built in Java Class Libraries. These library files are in our project in the classes folder: MRJClasses.zip and JDKClasses.zip. If you are starting a project from scratch, or if you do not have them in your project, you will need to add these files manually. To do so, select Add Files from the Project menu. In the standard file dialog, navigate to your MRJClasses folder (in the MRJ Libraries folder in the Extensions Folder of your active System Folder) and add JDKClasses.zip and MRJClasses.zip to your project. This step is vital. If you do not add these classes, your project will not compile. We can now start looking at how the files are organized. (You may need to click on the Files tab to get back to your list of files). |
| Previous Section | Table of Contents | Next Section |