Upgrading the JRE in CF for Custom Java Classes

ColdFusion , JRE , Server and Hosting Add comments

Wanted to blog this for future reference... I was working on a CF version of the MS Live ID Web Authentication API recently and hit a stumbling block when the Java class providing access to the Live ID API was throwing the following error:

500 windowsLiveLogin (Unsupported major.minor version 50.0) windowsLiveLogin (Unsupported major.minor version 50.0)

The problem was that I had compiled the class file with a newer version of the compiler than CF was using (currently v1.4.2_09). So I downloaded the archived version of the Java JDK for v1.4.2_09 and tried re-compiling the class file...the compiler didn't like the source file.

I was stuck on using a JRE of v1.5.0 or greater. After doing some research on this I discovered that to get CF to accept the class file I had to upgrade the JRE to a compatible version. I found this blog on Ben Forta's site: Changing the Coldfusion JRE Basically the following steps were suggested:

  1. Make sure the ColdFusion service is stopped.
  2. Download the JRun4 Updater from here. I downloaded JRun 4 Updater 6. During the Install of the JRun4 Updater select the install path to be the runtime folder of your ColdFusion install directory. "C:\CFusionMX7\runtime"
  3. Download and install Java JDK 1.5 ( jdk-1_5_0_12-windows-i586-p.exe ) For this I installed the latest J2EE of Sun Java System Application Server as just installing the JDK above didn't work for me. Maybe there were some paths needed changing?
  4. Open both jvm.config files found in these directories: C:\CFusionMX7\runtime\bin C:\CFusionMX7\runtime\updater6-backup\bin
  5. Find the line that sets the java.home property under the "VM Configuration" heading.
  6. Change "java.home=C:/CFusionMX7/runtime/jre" to "java.home=C:/Program Files/Java/jdk1.5.0_11/jre" in both files. Again, because I was using the Sun Java system, the path I used was "java.home=C:/Sun/SDK/jdk/jre".
  7. Restart coldfusion.

That should be it. Once CF was restarted, I was then able to access all the public methods and properties of the windowsLiveLogin class. In CF Administrator my System Information showed:

JVM Details
Java Version 1.6.0 
Java Vendor Sun Microsystems Inc.  
Java Vendor URL http://java.sun.com/
Java Home C:\Sun\SDK\jdk\jre  

 

NB: I don't recommend that everyone rush off to upgrade their JRE, unless specifically required. I performed this upgrade on my laptop first to see if it actually worked. Also I cannot guarantee this will work for everyones configuration, so if you do use the above, tread carefully. Niall.

Bookmark and Share

1 response to “Upgrading the JRE in CF for Custom Java Classes”

  1. Deepak Kumar Says:
    Awesome job,thanks a lot for the bolg..It helped me alot.

Leave a Reply

Leave this field empty:

Powered by Mango Blog. Design and Icons by N.Design Studio