Getting Java 5 to run again on my mac
For almost a year now I have been a developer on the opencsv project. Opencsv is a Java library for parsing comma separated value files. Its a cool project to work on and really handy to work on my spare weekends when I am on a iteration at work that is heavy in design or meetings and light on coding (when I start having coding withdrawals).
A couple of months ago I sent Glen an email stating that we had enough patches in for a new version to be created and he replied back with an incredible offer - would I like to become a maintainer on the project! I was excited to be trusted to maintain the project and readily agreed. But that excitement quickly became disappointment when I realized I had a major roadblock on my hands. One that could keep me from building opencsv altogether.
I have a Mac.
Not that the macintosh is a bad machine to develop on. Quite the contrary - I had been developing java apps for quite some time. So its really not the Mac's fault. The problem goes much deeper.
Apple hates Java.
There. I said it. For some reason Apple has never been too thrilled with Java and with Snow Leopard they went so far as removing all versions of Java EXCEPT for Java 6. All prior versions of Java were removed and replaced with links to Java 6.
Now this is not as bad as it sounds. Everything I have runs just fine in Java 6. The problem though is that by only having Java 6 I could not do a full deployment build of opencsv. This is because opencsv has a requireJavaVersion maven rule to only allow Java 5 when doing a maven install. The reason for this is that Java 5 is currently one of the most used versions of Java out there and while we switched from Java 1.4 to Java 5 for version 2 of opencsv there was no compelling reason to go all the way up to Java 6 and leave the larger populace out in the dark (though ask me again when Java 7 comes out
So here I am maintainer of a project that I could not build. So I set myself a task to deploy opencsv! Now bear in mind I did say I did this on my spare weekends and unfortunately between work (which was speeding up this year) and family (I am den leader of my son's cub scout den) those have been few and far between.
But I finally got my first break tonight. After many consultations with the great oracle Google I found several articles that made it possible to reinstall Java 5 and allow me to do a maven install on opencsv for the first time since the Java version was enforced.
First I found this article that showed me how to re-install Java 5 on my system. It was very well written and probably the first article I came across in a long time that worked following the instructions verbatim.
Then using this article I changed the version that Java defaults to. Then I found this article which showed me how to change my JAVA_HOME so its set to the selected version. This way maven uses the correct version and I can build finally!!!!!
Now on to deployment