[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

Appendix A.

 

Stand-alone Applications for Mac OS



You can use the CodeWarrior IDE to create stand-alone Mac OS Java applications. Normal Java applications are not stand-alone. They are output as class files or Jar files, and require a separate utility (such as a web browser) to run. Stand-alone Java applications, however, can run without the use of a separate utility. This chapter discusses how this process works.

Topics discussed in this section are:


About the MRJAppBuilder Application

Beginning with the release of Apple's MRJ 2.2, JBindery is deprecated. This release of the CodeWarrior IDE uses Apple's MRJAppBuilder to generate stand-alone Macintosh Java applications.


NOTE

If MRJ 2.2 is not installed and an older version of MRJ is present, the CodeWarrior Java linker will create a JBindery stand-alone application. All settings from the Java MRJAppBuilder settings panel also apply to JBound applications with the exception of the About Menu Name, Application Icon, and Splash Screen settings.


MRJAppBuilder is an application that binds the Java virtual machine interface to Java code to create Macintosh stand-alone Java applications. MRJAppBuilder supersedes JBindery and is supplied with current versions of the Mac OS Runtime for Java (MRJ) software development kit (SDK) from Apple Computer Inc. MRJ can be found on the CodeWarrior CD in the Cool Demos, SDKs, & Tools folder.

For more information on MRJAppBuilder and other parts of the MRJ SDK, see the documentation provided with those packages.


NOTE

Apple's MRJ SDK 2.2 must be installed correctly for stand-alone MRJAppBuilder applications to run. The files JDKToolsClasses.zip and MRJSDKClasses.zip should be copied from the MRJ SDK 2.2 Extensions folder to the following location: System Folder:Extensions:MRJ Libraries:MRJClasses.



Creating a Stand-alone Application

Following is a step-by-step guide to creating a stand-alone Mac OS Java application using the CodeWarrior IDE and MRJAppBuilder.

1. Create a new Java project.

Choose File > New from the CodeWarrior menu bar. The New window is displayed. Choose Java Stationery from the list, set the project name and location, and press the OK button. The New Project window is displayed. Select Java Application from the JDK 1.1 section and press the OK button.

2. Add or create Java files.

Choose Project > Add Files to add your own Java source files to the project, or create new source files by choosing File > New.

3. Open the Target Settings window.

Choose Edit > TargetName Settings (where TargetName is the name of the build target in question) to open the Target Settings window.

4. Change the main class setting.

Select Java Target in the settings panel list to the left of the window to display the Java Target settings panel. Change the Main Class edit field to the same name as your application's main class.

5. Set the Output Filename.

Select Java MRJAppBuilder from the panel list on the left-hand side of the window. This displays the Java MRJAppBuilder settings panel. Change the contents of the Output Filename edit field to whatever you want.

6. Set other MRJAppBuilder options.

Change any of the other options you want to change. For full descriptions of each item in this settings panel see "Java MRJAppBuilder".

7. Save your settings.

Press the Save button at the bottom of the window to save all of your settings, and then close the window.

8. Compile and run.

Choose Project > Make to create your application. The IDE builds the stand-alone application and supporting files in the same directory as your project file.

If the Merge output zipfile into application option is unchecked at the time of the build, the generated Jar file is placed in the same directory as the application. Otherwise, the Jar file is merged into the application. See "Merge output zipfile into application" for more information on this setting.

A .properties file containing properties required by the MRJAppBuilder application is also generated by the IDE and placed in the same folder as the application. This file must accompany the application for it to launch successfully. Some settings in the .properties file are transferred by the IDE from various target settings panels. See "Target Settings Panels" for more information.

Once the application has been successfully built, double-click it's icon to run it.

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 02, 2000