O'Reilly logo

Mac OS X Panther in a Nutshell, 2nd Edition by Jason McIntosh, Chuck Toporek, Chris Stone

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running Generic Java Applications

There are many Java developers who write code and never consider that their application might someday run on a Mac. After all, the whole concept behind Java is that the code can be written once and run anywhere. In many cases, these programs will run fine on Mac OS X. One of the biggest advantages of including a JVM with every Mac is the large number of programs that are enabled on the platform. In this section you will see how to run Java programs that aren’t specifically packaged for use on a Mac.

Running from jar Files

You have seen that a jar file is a Java archive much like a zip or tar file. Try this out:

  • Make a copy of the file Jar Bundler.jar that you found inside the JarBundler application.

  • Make a copy of Jar Bundler.jar with the name JarBundler.zip.

  • Expand the JarBundler.zip file using the version of StuffIt Expander included with Panther.

When you do, you end up with a folder containing many class files and two subdirectories. The META-INF folder contains a single file named, MANIFEST.MF. This directory and file are what differentiates a jar file from a zip file. The MANIFEST.MF file may contain the name of the Java class file intended to initiate the application; this makes the jar file double-clickable.

There are many advantages to working with jar files instead of the individual class files. When you zip up a bunch of files scattered across directories, not only is the result compressed and smaller than the sum of the individual files, you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required