Running Mac-Friendly Java Programs

There are two worlds of Mac OS X: the Unix side and the GUI side. On the one hand, there is the Unix side that has you popping open a Terminal window and typing sed, sudo, or ls. The typical Mac OS X user doesn’t spend much time in that world, mainly because the more public side of Mac OS X is the bright, shiny Aqua interface. Fortunately, you can run many Java programs by double-clicking on an icon or navigating to a web page.

There are many Java programs that fall into this category. The first type involves desktop applications written in Java, but installed and run just like any other native Mac OS X application. The second type is a Java applet, which typically runs within a web browser. When you open a web page that contains an applet, Java code is downloaded to your machine and run inside a restricted part of your disk called a sandbox. The sandbox approach is dependent on browsers to support Java from within. A third approach is a hybrid called Java Web Start (JWS). In this case you download a small piece of code in the browser, and a helper application takes over, allowing you to run the application independent from the browser. You can even choose to transform a JWS application into a standalone, double-clickable application.

In each case, Java code is executing on your machine using your instance of the Java Virtual Machine (JVM). There are other times you may be depending on Java code without knowing it. As you access web sites and use ...

Get Mac OS X Panther in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.