Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iamamthelawl

macrumors newbie
Original poster
Dec 16, 2007
15
0
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?

Thanks
 

therevolution

macrumors 6502
May 12, 2003
468
0
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 and Ruby 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 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.
 

elppa

macrumors 68040
Nov 26, 2003
3,233
151
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.
 

kuwisdelu

macrumors 65816
Jan 13, 2008
1,323
2
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.
 
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.
 

godrifle

macrumors 6502
Oct 20, 2003
268
117
Fort Thomas, KY
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:
 

bloomberg

macrumors newbie
Sep 8, 2007
25
5
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, 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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.