View Full Version : Is java still worth it to use on the mac?

Feb 15, 2008, 07:07 PM
After some time I was using obj-c and it was pretty good. I also wanted to see java as well because some examples some friends of mine did were amazing. I know obj-c takes a higher precedent than java in xcode with cocoa but is it still worth it to use java? I also heard about it being slow to update on the mac, is this true?


Feb 16, 2008, 01:27 AM
I'm not 100% sure what you mean by "worth it," but if your goal is to develop Cocoa apps, then Java is not for you. Apple used to have an official Java-Cocoa bridge, but it's been long since deprecated. ObjC, Python (http://developer.apple.com/cocoa/pyobjc.html) and Ruby (http://rubycocoa.sourceforge.net/) are supported, but not Java.

And yes, Apple tends to lag Sun quite a bit in releasing updated Java versions. We still don't have Java 6, whereas it's been out for over a year elsewhere. Now that Java has been open sourced, hopefully projects like SoyLatte (http://landonf.bikemonkey.org/static/soylatte/) will be able to close that gap - but we're still a ways off from that.

Other than these issues, Java on Mac works pretty well. I guess it depends on what you want to do with it.

Feb 16, 2008, 04:35 AM
Java is a bit more of a modern language, for example it has had garbage collection from the get go, whereas this has just been added to Objective C.

If you want to do cross platform stuff then yes, Java is a good way of going about it. The main two bad things are:

[1] Performance: All the code is run on virtual machine which runs on top of the processor. The extent to which this is an issue varies on a case by case basis. This is less of an issue than it was and I certainly don't subscribe to the java = slow school of thought.

[2] Exploiting OS specific features. Fairly obvious: You can't use Core Animation in a Java app.

If you want to write OS X apps, then Cocoa is the way to go. You have the choice of three languages, which have already been outlined above.

Feb 16, 2008, 07:49 AM
What elppa said.

The only real reason to write a Mac program in Java is if you want it to be compatible with other operating systems or if Java is your preferred language and you really don't feel like learning a new one (which isn't a real reason, anyway). The reason your friends' examples of Java were "amazing" were a) they are probably more familiar with Java than you are with Objective-C and b) Java is a relatively easy language to learn where you can get a program up and running fairly quick.

If you want to program applications that will easily be cross-compatible with multiple operating systems, then Java is the way to go.

If you want to program the best OS X applications you can and want them to be as "Mac-like" as possible, but don't care if you can't use them in Windows, then Objective-C and Cocoa are what you really want to use.

Feb 16, 2008, 09:56 AM
Another consideration is the large number of libraries available through Java.

I have ended up using Java for the large number of supporting libraries, especially when it comes to database connectivity. Of course, you can use c / c++ libraries if there is a native Mac implementation and you have the overhead of different programming models in a single project.

Feb 16, 2008, 01:29 PM
Java is both slow to be released on Macs and (anecdotally) slow to run on Macs. I have a top of the line MacPro, and a specific web-based Java app that I must use performs faster on WinXP running in Parallels on my MacPro than it does on the same machine is Mac OS X 10.5.2. :mad:

Feb 18, 2008, 11:38 AM
I disagree that Java is slow on Mac. A memory hog, yes, but not slow. I worked in a VM environment for six weeks when Leopard broke jdk6 and while it's great to have the option to do so, it was fantastic to finally switch back to native java.

The real problem with java development on mac is that while most developers are looking forward to jdk7 and can even download nightly builds of jkd7, (https://jdk7.dev.java.net/) those of us on mac are still waiting for a proper jdk6 well over a year after its official release.

For that reason I don't recommend macs for java developers unless you're sure you don't require a current jdk.

Feb 18, 2008, 03:21 PM
I too wish Apple would either:

a) publish a full 1.6 release
b) get off their high horse and let the Open Source community run with it.