Running Java Applications on Mac OS X
Pages: 1, 2
If we had a double-clickable app for Jini tools, Mac could be the platform of choice for Jini development. Is there any work underway in this area?
If you click on the green button, there can be a redrawing problem with the larger window that is corrected if you do a live resize by grabbing the lower-right corner. There's more, however, to the Mac experience than just being able to use the genie effect while shrinking JUnit down to the dock. In the next section, we'll look at making the user experience more Mac-like.
Creating a double-clickable version
You don't want a user to have to navigate to the right directory and type in the class path every time they run JUnit. One of the cool things Apple did in shipping Mac OS X was to ship the developer tools along with the operating system. We'll use
MRJAppBuilder to quickly package JUnit up as a double-clickable app. You'll find
MRJAppBuilder in the /Developer/Applications/ directory. Start it up and let's start filling in the various fields in the Application tab pane.
In our first shot, let's fill in the fields with the same values we used from the command line. There the main class name was
junit.swingui.TestRunner and the class path was
[Install Dir]/junit3.7/junit.jar:. . This class path is interesting because it uses one absolution path and one relative path. The "." assumes that we're inside of the
[Install Dir]/junit3.7 directory, so we're forced to put our output file there. We could change the "." to an absolute path and place the output file anywhere. For now, we choose the clever name
junit.app for our output file and set the fully qualified name as
This is fine if you are just creating a quick application that will sit on your own machine. If you use absolute paths, you can move
junit.app anywhere on your machine. On the other hand, if you are interested in using this technique to deploy applications to other users, you should use relative paths. This way your application is not dependent on the directory structure of the user's machine. In our case, we can change the class path to
junit.jar:., and choose "Build Application".
You'll notice that we didn't enter the name of the test suite being run. To add a parameter, select the Java Properties tag. You'll see that you can add properties to be set and modify many of the ones that you see. If you'd like, add the parameter
junit.samples.AllTests and rebuild your application. In this case, we won't notice a real difference, but with other applications this will be useful.
The first community challenge: Jini
Perhaps the hardest thing about working with Jini is getting all of the pieces working on your machine. There are many sites that are devoted to long descriptions of the steps involved in getting
rmid, a web server, Reggie, Mahalo, and Outrigger up and running.
Our first community challenge is to use the discussion forums on this page to come up with a very simple solution for running Jini on Mac OS X. You can find out more about Jini at Jini.org, and in Jini section of the Sun Microsystems web site. You can start up Jini with a GUI tool that comes with the distribution. To do this, just load the
jini11_unix.properties file you will find in
Daniel H. Steinberg is the editor for the new series of Mac Developer titles for the Pragmatic Programmers. He writes feature articles for Apple's ADC web site and is a regular contributor to Mac Devcenter. He has presented at Apple's Worldwide Developer Conference, MacWorld, MacHack and other Mac developer conferences.
Read more Java Programming on the Mac columns.
Return to the Mac DevCenter.
MRJAppBuilder replaced by Jar Bundler
2003-07-22 04:12:35 anonymous2 [View]
Inner Class Names Chopped Short
2002-04-11 09:49:27 macneil [View]
How to change icons ?
2002-01-24 08:19:27 mhadley [View]
Deploy Java Applications
2001-09-19 06:20:08 mauri [View]
Swing & Menu bars
2001-08-21 14:56:06 larucker [View]
Class not found
2001-08-19 12:19:07 boscarol [View]
"failed to invoke" error message
2001-07-19 14:11:20 wt [View]
Stuffit wouldn't work for me
2001-07-08 10:23:47 canyonrat [View]
2001-07-07 22:28:34 u1mpg [View]