Setting the correct Java version under MacOS X
My favorite scripting language is CFML, or as some know it as ColdFusion. I like it because it is very very powerful, easy to use and can do just about everything your xyz language can do.
For many years, ColdFusion was a closed sourced system, where the former Macromedia and now Adobe got the copyright of the code. Luckily, this has changed when OpenBlueDragon (OpenBD) came to play with the first open source CFML application server. So, now the CFML world got a very nice open source CFML language and server. Our very own open source Digital Asset Management – Razuna – runs on OpenBD as well and comes bundled with it.
Anyhow, the reason of this blog post is not CFML, but how to set the correct Java JRE environment under MacOS X. Then why did I mention CFML and OpenBD in the first place, you might ask?
Well, today I downloaded the latest version of OpenBD which runs now on Java 1.6 and is 64 bit. But when I tried to start our server (Tomcat) with the new OpenBD jar I got the following error messages in the log.
at org.apache.catalina.startup.
Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class com.naryx.tagfusion.cfm.application.cfHttpSessionListener)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal (WebappClassLoader.java:1854)
As we can see from the “Bad version number…” in the above line there must be some misconfiguration of the Java runtime going on. But wait, does my execution of “java -version” not state that I’m running the latest Java version? Reading from those lines, you could think so.
java version “1.6.0_13″
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)
Apparently when one looks into the Java paths of MacOS X we see that the current “JDK” is set to 1.5 and not 1.6. Judging from this, I tend to think that Apple is not setting the JDK right for Java applications. You might say, well then just set it in the “Java Preferences”, right? Wrong, I already did that as the screen below shows).

So, in order to solve this, I set the correct JRE_HOME variable in my .profile in order for all Java applications to pick up the current JRE. To do that, you simple edit your .profile (with vi ~/.profile) and add the following lines to it:
JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
export JRE_HOME
Save it, open a new terminal window (or close and open one) and start Tomcat. Now Tomcat is picking up the new JRE path and Java application, in my case OpenBD, that depend on the Java 1.6 JRE version will run.
Hey guys… Just found this blog at Google. Thank you for the good information and I’m digging into the other posts now. Keep up the good work!
I am really happy with ur blog and will book mark this
ADD MY MSN – GUYS ONLY X – sexysizzlegirl@hotmail.com
I’m happy someone decided to sooner or later shed light on this. I have pondered it numerous times before.
I like when you talk about this type of stuff in your posts. Perhaps could you continue this?
This is a good blog. Keep up all the work. I too love to blog. This is great everyone sharing opinions
This is a nice blog i must say, usually i don¡¯t post comments on others¡¯ blogs but would like to say that this post really forced me to do so!
This is a good blog. Keep up all the work. I too love to blog. This is great everyone sharing opinions
Hi i love your blog, found it while randomly surving a couple days ago, will keep checking up please do visti mine if you wish
. Btw yesterday i was having troubles opening the site. Bye…
A thoughtful opinion and ideas I will use on my blog. You’ve obviously spent a lot of time on this. Well done!
This is a good blog. Keep up all the work. I too love to blog. This is great everyone sharing opinions
We are a group of volunteers and starting a new scheme in our community. Your post provided us with valuable information to help us get started|.You have done a marvellous job!
This is my first time I have visited here. I found a lot of interesting information in your blog. From the tons of comments on your posts, I guess I am not the only one! keep up the impressive work.
Hey guys i wish to share with you a way i make $500 every day and i only spend 5 minuites doing it a day! I strongly suggest you check their site out as there is really a brilliant video that explains everything you need to know. Check them out at DOMINATE MOBILE MARKETING
Adding to my bookmarks thanks, a good quick read.
How quite a few sociable web-sites do we seriously require? You can find like 10k interpersonal web sites lol
just retweeted this .. good stuff
Hi, i was just doing some browsing at work. Your Posts are Really Awesome! Where is Subscribe Button in this blog?
this was a very entertaining read. i enjoyed it very much!
Not long ago i observed your current blog post and have been recently reading through alongside. My partner and i seen a number of strange comments, nevertheless typically I simply trust what the other rewiewers are creating. Experiencing a lot of wonderfulgreat reviews of the website, I had been thinking that we also need to join in along with advise you that I loved looking over this article. And so i believe this may help to make our initial review: “I believe you might have built a few important factors. Not necessarily more and more people would certainly really ponder over it how you only did. I’m actually pleased that there are a great deal about this topic which have been uncovered and you made it happen so nicely, with a lot training!inch