Upgrading the JRE used by Coldfusion

Published: {ts '2010-09-25 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/upgrading-the-jre-used-by-coldfusion/

Recently I was investigating some performance issues on a Coldfusion 8 box. During the course of my investigations I discovered that JRun was using the default release of java 1.6.0_4 which it ships with. This was one of the first issues I tackled.

Issues with Java 1.6.0_4

When Coldfusion 8 was release Adobe pushed the envelope by using the then new 1.6.0_4 edition of Java. This was supposed to bring enhanced speed and performance. However it was quickly discovered that there was a bug in the Java class loader which actually caused performance issues. This was particularly bad in applications that used frameworks or made extensive use of components.

The Solution

At the time the solution was to downgrade the JRE to 1.5.x. Fortunately the problem was addressed with the java 1.6.0_10 release (08 Aug 2008). Anyone still running the default version of java should update to the current release. At the time of writing this was 1.6.0_21.

Step 1: Confirm Your Current JRE

To confirm the current jre log into the Coldfusion Admin and click the information icon the white "i" on a blue background. Look for the Java Version listed.

Step 2: Download The JDK

Once you have confirmed if you need to update your jre the next step is to download the current J2SE JDK (Java Development Kit). Note: Coldfusion needs the 'Hot-Spot JVM' which does not ship with the standard JRE. Install this to your machine. On my system I ended up with an install path of:

c:\program files\java\jdk1.6.0_21\

Step 3: Update jvm.config

The jvm.config file defines the path to the JRE and the runtime arguments such as setting garbage collection options. This file is located in the bin directory which depending on if you are on standard or enterprise will be located as follows:

Enterprise CF Bin Location

C:/Jrun/bin"

Standard CF Bin Location

C:\ColdFusion9\runtime\bin

Make a backup copy of the config file then open it using notepad. Look for the following line and edit it to point to the new jre located inside the jdk folder.

java.home=[path/to/current/jre]

Based on my java install path of c:\program files\java\jdk_1.6.0_21 I changed the java.home value to read:

java.home=c:/program files/java/jdk1.6.0_21/jre

Note: Do not use the java/jre6 folder which also gets created as this does not include the 'Hot-Spot JVM'.

Step 4: Restart Coldfusion

The last step is to restart coldfusion and test if everything is working. In particular test your webservices as some people have noted problems.

Note: It should be noted that if you change to a different major release of Java such as the 1.5.x branch that the "tools.jar" file will cause a version mismatch. This can be rectified by replacing it with the one that came with the jdk download.