Mac Osx For Java Development

MacOsx comes with Java 1.4.2 and JavaWebStart as standard.

There also is a specific look and feel manager for Aqua look. This one is default standard, if no other is selected in the application. RobertDietze

The CocoaJavaBridge? allows applications to be written in Java, but with MacOsx native GUI. All ObjectiveCee Cocoa APIs have a Java equivalent. However, as Cocoa was designed for ObjectiveCee, you're generally better off coding it in that language, or you'll be inserting a square peg into a round hole.

A more useful feature of the bridge is that you can create and address Java objects in Objective C as if they were Objective C objects. This ability to call Java code directly allows for the use of Java libraries in MacOsx applications where no equivalent native libraries exist.

OS X provides proprietary features allowing greater integration with the native desktop-- for example, a system property to use a global menu bar instead of per-window menu bars, and a helper class with some native functions.

Maybe the coolest thing about Java on OS X is that you can very easily make native application bundles out of JAR files (complete with icon libraries and file type associations) just by setting up the right directory structure.

The O'Reilly book MacOsxForJavaGeeks? is very useful, though a little out of date by now.

IDEs:

J2EE It's not very interesting to say that pure Java programs work on OS X; isn't that the whole point of Java?


Can someone tell me exactly what to type to make my directory of .class files into a clickable OS X application? Thanks.

I believe there's an application included with the Mac OS X developer CD to do this. I am not sure if it will JAR up your class files, however.

Off the top of my head, here's the manual command-line process to make an executable JAR on any platform:

1) Create a text file "MANIFEST.MF" (all caps) that contains the following text:

 Manifest-Version: 1.0
 Created-By: 1.3.1 (Sun Microsystems Inc.)

Main-Class: <fully qualified class name of the main() method you want to run>

2) JAR up your directory of .class files and provide this custom manifest you just wrote.

 jar cvfm myjar.jar <path to MANIFEST.MF> <directory to jar>

3) That should do it. The Java Launcher in the Applications->Utliities directory I believe can launch executable jars.


Once you have a JAR file, you can use the MRJAppBuilder application that is part of the developer tools to build the OS X style 'packaged application'. -- ChadThompson


...although that's just a convenience; simply setting up the proper directory structure and property files (although too much to go into here) will make the OS recognize it as an application. See Apple docs or the O'Reilly book.


EditText of this page (last edited November 11, 2004) or FindPage with title or text search