Skip navigation

Monthly Archives: November 2008

I’ve recently switched over from developing on Windows XP to OS X. Now that I’ve been using OS X for a few months, I’m kicking myself for not switching over earlier.

However, in addition to the change in operating system, I’ve also decided to move over to the often acclaimed IntelliJ IDEA for all of my dev needs. It’s amazing what this IDE is capable of doing. It’s currently my one-stop dev shop. Everything from SVN, Java, Freemarker, Grails, Javascript, and even XHTML/CSS editing.

I’m currently using it for Java, Javascript (Dojo), Grails, and DHTML. There’s no turning back. Really, with OS X and it’s multiple desktop integration, I’m feeling productivity gains like never before.

I’ve yet to use IntelliJ for Flex development, as I’m already familiar with Flex Builder, but I’m edging closer and closer to giving it a try. I’ll blog more as I delve into Flex development with IntelliJ. I’m sure it will be fun.

Stay tuned.

Advertisements

By default OS X Leopard (10.5.5) ships with Java JDK 1.5 as the default JDK. This is fine until you actually need to compile an app dependent on 1.6, or even run an app that demands the latest API for JRuby or even Glassfish.

If you search the web for “OS X Java JDK 1.6” you’re likely to get blog posts related to the “SoyLatte” release of JDK 1.6. These blogs generally provide shell commands and environment setups that are required to compile the “SoyLatte” build of Java 1.6 for OS X. Aside from the lengthy process description, the real frustration comes in the contradictory experiences posted in the comments of said blogs. Quickly, the “upgrade” becomes disheartening.

There’s hope! (And it’s surprisingly easy…)

From Finder simply open “/Applications/Utilities/Java/Java Preferences” and drag “1.6” to the top of the list. You should now be able to confirm JDK 1.6 from the Terminal by typing “java -version”. You should see “1.6” (or something at least starting in 1.6.)

Now for Maven. The tricky part lies in your environmental $JAVA_HOME variable being set to the JDK 1.5 path. In the terminal, locate your Bash profile. (Mine lives at “/etc/profile”.) You’ll need to run “sudo” to edit and save the file.

Inside profile, you should have the following line as required by Maven:
JAVA_HOME=/Library/Java/Home; export JAVA_HOME;

If you do not see this line – I’m not sure this post applies to you…

Anyhow, “/Library/Java/Home” is a symbolic link that is still pointing to the JDK 1.5 “bin”, which prevents Maven from running the appropriate Java version. (This, of course, is correct if you’re forcing JDK versions through Maven.)

You’ll now want to alter the $JAVA_HOME variable to the following:
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home; export JAVA_HOME;

Save your profile, open a new Terminal session — that should do it. Via the OS X preferences pane, you’ve directed OS X to the JDK 1.6.  While through the $JAVA_HOME variable, you’ve pointed Maven to the appropriate JDK.

Hope that helps.