Mac OS X sports a new look, not just on the outside with its great look
and feel but also on the inside. OS X is proudly built on top of a BSD Unix-based
core foundation. An exciting aspect of the new operating system is that the
latest version of the Java 2 platform (J2SE v1.3) is preinstalled in every
Macintosh notebook and desktop preloaded with OS X. (The current release
is 10.1, however, in this article I’m referring to the latest version of
OS X, v10.1.1.)
This dramatic shift in Apple’s strategy toward Java support in Mac OS
could jump-start the deployment of Java-based applications and services on
a user-friendly consumer operating system, specifically with the issues surrounding
Java support in the new Microsoft operating system, Windows XP. This article
reviews the features of Apple’s Java implementation and explores what makes
OS X a great operating system for the development and deployment of Java-based
Introducing Mac OS X
OS X is what a lot of developers want – a familiar Unix-based core with
a highly productive and great-looking user interface. Built on top of BSD
Unix, OS X represents a significant change from its predecessor, Mac OS 9.
Darwin, the core of the operating system, combines the services provided
by Unix and the Mac 3.0 kernel with support for high-performance networking
capabilities. Apple took a big step toward the adoption
of Darwin by making it an open source project (www.darwin.org).
Darwin supports a flexible model that in turn supports multiple file systems,
including a Universal File System, ISO 9660 (for CD-RW disks), Universal
Disk Format (for DVD volumes), and Mac OS Standard HFS. Key to Darwin is
support for standards-based connectivity including TCP/IP, PPP, HTTP, FTP,
DNS, DHCP, LDAP, and NTP.
Layered on top of Darwin are three graphics subsystems:
1. Quartz: A lightweight window server and PDF-based 2D
graphics rendering library
2. Open GL: A 3D rendering model
3. QuickTime: For multimedia capabilities
To provide compatibility with its predecessor, Mac OS 9, OS X also supports
a “classic” mode, which makes the system available in a dual operating system
mode by running both the OS 9 Classic and OS X operating system. (It’s actually
possible to configure OS X to boot with the two operating systems at start
up to avoid the delay of a later start up.)
From a development perspective, OS X provides multiple options – Carbon,
the traditional Mac OS API that supports completely backwards compatibility
with OS 9, and Cocoa, Apple’s next-generation development framework for OS
X “native” applications. A key component to OS X and the focus of this article
is Apple’s support for the latest version of the Java platform. OS X 10.1
supports Java 2 Standard Edition (J2SE) version 1.3.1, and HotSpot, the latest
production version available for Java deployment. Java is treated as a first-class
citizen in OS X and, along with Cocoa, is expected to represent a key framework
that developers will mostly adopt to build applications for OS X.
The beauty of OS X is its most visible piece, Aqua, OS X’s new user
interface. Even though Mac OS is traditionally known for its ease-of-use
and intuitive GUI, Aqua makes OS X stand out and represents a dramatic user-interface
paradigm shift for an operating system. (Figure 1 shows the various components
of the OS X architecture.) A key highlight of Aqua is the intuitive dock
(as shown in Figures 2–4 toward the bottom of the screen). Having worked
in multiple user-interface environments before, I found Aqua has a huge leg
up with respect to usability and user friendliness.
OS X and Java
As we’ve seen in the previous section, support for Java in OS X is strategic
to Apple’s new operating system. Every installation of OS X includes a preinstalled
version of J2SE 1.3 VM runtime and command-line tools. This is important
as developers can now back the latest production-quality Java technologies
in the core platform. It’s quite refreshing to start a terminal session in
OS X and type “Java” or “Javac” and find out that J2SE is preinstalled and
configured on the OS. Table 1 summarizes some key environment characteristics
of OS X support for Java.
A distinguishing factor is that OS X doesn’t just embed Java into the
core operating system, it actually takes the integration to the next level.
For instance, a key highlight of OS X’s Java support is the native preemptive
multitasking threads support that can have a true impact on the performance
of Java applications and allows developers to utilize symmetric multiprocessing-based
systems. Another great runtime extension to Java in OS X is the ability to
share class files and HotSpot compiled code across multiple invocations of
the virtual machine. Implications of this feature can be significant, as
it can be a boon to interactive Swing-based applications, which are typically
memory intensive. Shared code can remove a lot of the overhead associated
with reloading the large number of classes required for production-quality
Key Highlights of Java Support in OS X
• J2SE 1.3: Includes the HotSpot Java Runtime Environment
(JRE), Java compiler, and other command-line tools.
• OS X Look and Feel: An Aquafied implementation of Swing
on OS X that gives Swing applications the brand new OS X look and feel.
• Java Web Start: An exciting new technology that holds
a lot of promise (see Sidebar). To use Java Web Start on OS X, you can use
applications developed by third-party vendors who use this technology. For
instance, UML-based modeling has gained wide acceptance in the developer
community. ArgoUML, an open source UML-based modeling environment, is quite
useful and is packaged as a Java Web Start application. Figure 2 shows ArgoUML
in action with Java Web Start.
• QuickTime for Java: A set of cross-platform APIs that
allows Java developers to build multimedia, including streaming audio and
video built on top of QuickTime 5, into Java applications and applets.
• Java Spelling Framework for OS X: A set of JavaBeans
that adds spell-checking to Swing applications.
• Java Speech Framework for OS X: A set of JavaBeans that
adds speech synthesis and speech recognition to Java applications.
• Cocoa Application Framework: An evolution from NeXTStep
APIs, Cocoa is a collection of advanced, object-oriented APIs for the development
of Aqua-based applications for OS X using Objective C and Java. Apple includes
a set of Java classes that allows Java developers to build multimedia-enriched
applications based on the OS X-specific Cocoa framework.
• Interface Builder: Another tool that’s part of the Developer
Tools CD, it can visually create the user interfaces used by Cocoa applications,
then the associated event can be linked using Java code. The rule of thumb
is to use Swing-based components for cross-platform compatibility, and Cocoa
to utilize Aqua-based interfaces and target OS X-specific deployments.
• Project Builder: Supports Java development in Apple’s
Project Builder IDE.
• JNI: Supports invoking native OS-specific API and embedding
Java into native applications using standard Java Native Interface (JNI)
• JDBC: Pure Java (or Type 4) JDBC drivers can be used
to access database systems such as Oracle.
Developing Java Applications Using OS X
OS X is very Unix-friendly as a development environment. All the utilities
that we’re familiar with on other Unix platforms (typically Sun Solaris,
HP-UX, and Linux-based servers) are available in OS X. This benefits developers
who intend to use traditional Sun Solaris, HP-UX, and AIX environments for
high-end Java deployment but would like to have the ease-of-use of OS X.
For a lot of developers (including me) who still like to use command-line
tools, there’s good news: vi and emacs, along with other Unix-style utilities
such as awk, sed, and shell scripting (OS X includes multiple variants of
shell implementation including sh, csh, tcsh and zsh), are all included in
OS X. For developers who like the power of X-Windows, a port of X-Windows
System is also available for
If you work with tools such as vi/emacs to develop Java code, you don’t
need any further coaching. Start a terminal session in OS X and you’ll be
in a familiar shell interface (tcsh). However, if you’d like to take advantage
of the benefits of an IDE, OS X presents several options at the core with
Apple’s own Project Builder toolset. (Figure 3 shows Project Builder debugging
a simple Java application.) Project Builder is Apple’s IDE for Mac OS X and
is designed to support multiple development frameworks and languages. It
supports C, Objective C, C++, and Java development using Carbon and Cocoa
frameworks and Java, and also includes a new set of application-packaging
mechanisms for easy distribution.
Project Builder is available on the Developer Tools CD, which is included
with every shipment of OS X. From an IDE perspective, Project Builder supports
core features, including workspace-based project editing, source-code management
based on CVS, search and navigation, file editing, and building, running,
and debugging facilities. From a Java developer’s perspective, Project Builder
supports the Java class browser and the WebObjects platform, and has the
integrated ability to create clickable applications for the OS X platform.
Its great performance and ease of use are instrumental in its usability.
Apple Project Builder
Apart from the core facilities of an IDE, Project Builder is pretty
basic. For users interested in using an integrated user interface design,
integrating with UML modeling tools, and wizard-based application generation
capabilities, OS X has support from a host of third-party vendors and organizations.
Borland recently released JBuilder 6.0 for Mac OS X for developing and deploying
Java applications, JavaBeans, applets, JSP, and servlets. It features an
integrated set of tools including an editor, debugger, compiler, and visual
designer. Apart from this, Code Warrior from Metrowerks is a popular IDE
on a Mac environment. NetBeans, the Java-based open source IDE from Sun Microsystems,
has been successfully tested on the OS X platform (www.netbeans.org
provides the instructions to run NetBeans on OS X). Running Forte for Java
3.0, a commercial IDE based on NetBeans 3.2 technology, is very similar.
Since OS X completely supports J2SE 1.3.1, you can potentially use any other
IDE built using Java as well.
Server-Side Java and OS X
As the name suggests, OS X Server is the server version of the OS X
operating system. Key highlights of OS X Server include support for file-sharing
services using Apple AFP, Windows (using Samba), FTP, NFS, Mail (IMAP, SMTP,
POP3), and print services; Web services using Apache Web Server with WebDAV,
PHP, CGI, WebObjects, and SSL support; QuickTime-based streaming media services;
and open standards–based TCP/IP services, including DNS, DHCP, SLP, LDAP,
graphical installation, configuration, and administration.
Mac OS X Server (version 10.1) extends the philosophy of using and embedding
Java technologies. It automatically installs a preconfigured version of Apache
Web Server (version 1.3.20) and Apache Jakarta Tomcat (version 3.2.3), the
most popular reference implementation of server-side Java technologies (servlets
and JSP in the /Library/Tomcat folder). To configure the OS X Web Server
to work with Tomcat, uncomment the three lines in the Apache configuration
file (etc/httpd/httpd.conf) to load the mod_jserv module, run Tomcat (/Library/Tomcat/bin/tomcat.sh),
and restart the Web server using the server administration tool. Optionally,
the Web server root can be set to Tomcat root application directory (/Library/Tomcat/webapps/ROOT/)
to test the Tomcat instance. Figure 4 shows Tomcat in action on OS X and
the Web server administration interface.
Keep in mind that the bundled Tomcat installation is version 3.2.3.
If you need support for the new Servlets 2.3 and JSP 1.2 API (part of J2EE
1.3), download the latest version of Tomcat (v4.0.1) from http://jakarta.apache.org/tomcat. It involves replacing the 3.2.3 folder with the latest version
and updating the httpd.conf configuration file with the new mod_webapp module
provided by the Tomcat 4.0.1 binary distribution.
Tomcat can not only be used to serve dynamic Java applications from
OS X, but can be a very effective local testing tool as well. It’s worth
noting that even though we were discussing OS X Server, Tomcat and other
server-side application engines can be seamlessly executed on a regular OS
X operating system as well; OS X Server just makes the step easier with an
embedded installation/configuration. From Apple’s perspective it would be
nice to make Tomcat configuration/administration seamless from the server
console, similar to the way it’s done for other services such as Apache Web
Server and FTP Server. TomcatX (http://homepage.mac.com/rlaing/TomcatX.html
), a simple Cocoa-based graphical utility, was also useful in starting Tomcat
Beyond Tomcat: J2EE
Since OS X completely supports J2SE 1.3, other third-party J2EE application
servers such as Orion and JBoss, which are completely written on top of Java,
can be used to develop and deploy J2EE applications on an OS X platform as
well. For instance I successfully tested the latest version (1.5.2) of the
Orion Application Server (which is also the key constituent of Oracle’s J2EE
application server) on my OS X Server installation. The Orion Application
Server (www.orionserver.com) is a freely available (for development
purposes) J2EE-based application server and implements key J2EE technologies
including EJB, JNDI, JTA, JMS, JDBC, JSP, and servlets. Apple’s own WebObjects
platform, which supports a server-side enterprise Java platform, is expected
to move toward J2EE compliance as well. This area needs greater focus from
Apple and third-party application server developers (such as BEA and IBM)
to make J2EE development and deployment smoother on OS X.
Is Mac OS X a Perfect Candidate for Java Development?
It’s clear that Java and OS X are good for each other. Should OS X be
your next Java development environment? In this section I’ll explore how
OS X maps some fundamental requirements from a developer’s perspective and
attempt to map the various tools and technologies around OS X and Java by
discussing the key development requirements and key enablers in Apple Mac
Java Runtime and Development Kit (Including Compilers)
OS X embeds J2SE version 1.3.1 with the HotSpot Client VM.
Support for J2EE-Based Application Servers
Apache Jakarta Tomcat, which implements the JSP and Java servlets component
of J2EE, is embedded into the OS X Server platform; for nonserver users Tomcat
can be easily installed and configured as well.
Other pure Java-based J2EE application servers such as the Orion Application
Server and JBoss can be used on OS X as well.
Java Development Tools
Numerous development tools are available, for example:
• Apple Project Builder
• Borland JBuilder 5.0/6.0
• NetBeans 3.2 and Forte for Java 3.0
• Metrowerks CodeWarrior for Java
• Other popular IDEs are expected to follow suit with OS X ports
Database Connectivity Using JDBC
Database connectivity is a crucial aspect of most enterprise application
development. Since OS X completely supports J2SE 1.3, JDBC support is built-in.
If your database vendor or a third-party supplier has a Type 4 pure Java
JDBC driver, you can use that driver with JDBC for OS X. A port of MySQL,
a popular database system in the Linux community, is available for Mac OS
X (actually OS X Server includes it as part of the installation). Other RDBMS
options on OS X include PostgreSQL and InstantDB. Since OS X has roots in
BSD Unix, we can expect more database vendors to port their databases natively
for the OS X environment.
UML Modeling Tools
As highlighted earlier in the article, ArgoUML, a Java-based UML, is
available as a Java Web Start application.
To aid in the development of installation scripts/programs for deploying
Java-based applications, a number of options are available:
• Project Builder–based creation of clickable .app applications
• Installer VISE 7.x from MindVision Software
• Install Anywhere 4.5 from Zero G Software
Ease of Deployment
Key highlights that aid the deployment of Java applications include
J2SE with a HotSpot Client VM, support for Java in Internet Explorer, and
Java Web Start.
Web Browser with Java Support
Microsoft Internet Explorer and Netscape X 6.2 with the latest Java
support are both available on OS X.
Office Productivity Tools
Microsoft has ported Micro-
soft Office for OS X including Word X, PowerPoint X, Excel X, and Entourage
X (e-mail collaboration tool). Office is now available on OS X, as it seamlessly
makes life easier for Java developers on the Windows platform since they
also need productivity tools (documentation, presentations, spreadsheets,
etc.) apart from Java development. OpenOffice, a port of the open source
office toolset, is underway as well.
Apple is known for great hardware. Not only from the outside but also
from the inside. For instance, my choice for running OS X would be the sleek
Titanium PowerBook G4 Notebook. Powered by a fast 66MHz PowerPC G4 processor,
48GB hard-disk drive, support for up to 1GB of RAM, a slot-loading CD-RW/DVD
drive, built-in wireless LAN support through Airport, and an almost infinite
expandability option with FireWire and USB support, the 1 in. thick and 5.3
lb portable notebook with 15.2 in. display has everything a developer could
dream about. And you can always make your family and friends feel good by
creating movies and DVDs using Apple’s iMovie and iDVD software when you’re
not developing Java applications.
OS X marks a revolutionary step toward usability and ease of use for
a productive and a user-friendly operating system. With its built-in support
for the latest version of the Java platform and the key benefits it brings
to the table, including the excellent hardware, Microsoft Office, and built-in
wireless connectivity, OS X is definitely a candidate for your next operating
system for building and running enterprise-class Java applications.
• Apple Mac OS X: www.apple.com/macosx/
• OS X Developer Community: http://developer.apple.com/macosx/index.html
• Apple Java Developer Community: http://developer.apple.com/java/
• Java Web Start: http://java.sun.com/products/javawebstart/index.html
• ArgoUML: http://argouml.tigris.org
• JBuilder on OS X: www.borland.com/jbuilder/mac/
• Mac OS X Server: www.apple.com/macosx/server/
• WebObjects: www.apple.com/webobjects/
Hitesh Seth is chief technology evangelist for Silverline Technologies, a
global e-business and mobile solutions consulting and integration services
firm. He has extensive experience in the technologies associated with Internet
application development. Hitesh received his bachelors degree from the Indian
Institute of Technology Kanpur (IITK), India.