ColdFusion Muse

Ask-a-Muse: How Do I Upgrade the JVM?

Mark Kruger June 11, 2009 2:41 PM ColdFusion, Coldfusion Troubleshooting Comments (7)

Muse Reader Rob Asks:
I have a silly question. How exactly do you upgrade the JVM on your ColdFusion server? My server is on Win2k3 x64 and the JVM version is 1.6.0_04. Do you specify it manually in the jvm.config file?

I'm glad you asked this question because it reminds me that I sometimes give advice without any follow through - which is the same problem I have with my 8 iron. Upgrading the JVM on a windows installation is pretty easy. Just remember that you will need the correct Java Runtime for your platform and ColdFusion version. Rob specified Win2k3 x64 so I assume he means he is running ColdFusion 8 enterprise 64 bit - in which case the target version is 1.6 update 14 (or 1.6.0_14). I usually start at the Sun Java download page. Once you have the right version in hand the rest is easy.

  • Install it somewhere convenient. For my local dev workstation I put it in C:\jdk1.6.0_14\.
  • Open the jvm.config file. If you don't know about this file shame on you. It means you have not adequately tuned your ColdFusion server.
  • Find the line near the top that starts with java.home=. I usually copy this line and then comment it out so I have an easy rollback plan. The value given after the equal sign will be the location of your current Java runtime. If you have CF installed in a typical configuration it will say C:/ColdFusion8/runtime/jre
  • Change the value after the equal sign to point to the JRE folder of your new installation. For example, mine says C:/jdk1.6.0_14/jre.
  • Restart the ColdFusion service.
  • If it restarts successfully log into the cfide administrator and take a look at the "settings" page (the "I" icon at the top right). You should see the new Java version as 1.6.0_14.
  • If the service restart fails take a peek in /coldfusion8/runtime/logs/*.out.log. It will probably have a clue in the last entry or two.

There are two more things to note. First, you may have noticed that the path specified in jvm.config uses front slashes instead of back slashes. This is one of the nuances of Java on Windows. Java treats the front slash as a path delimiter, but it requires the back slash to be escaped (at least in ini and properties files). So you could use backslashes, but if you did it would look like C:\\jdk1.6.0_14\\jre\\.

Second, you really want to have a rollback plan at the ready. Minor build upgrades are typically quite safe (as in moving from 1.6.0_4 to 1.6.0_14), but major upgrades and downgrades (as in moving from 1.5 to 1.6 or visa versa) have a tendency to produce unexpected results. If at all possible test the new version before rolling it on a production server. That's good advice for pretty much anything that functions at the system level.

Additional Resource

Finally, my good friend and colleague and all around Linux smarty pants, Ryan Still has posted these instructions on upgrading your JVM that include some great information on upgrading a Linux installation.

  • Share:

7 Comments

  • Pragnesh Vaghela's Gravatar
    Posted By
    Pragnesh Vaghela | 6/11/09 1:32 PM
    You can also update the JVM path via CF Admin (Server Settings > Java and JVM)
  • Mark Kruger's Gravatar
    Posted By
    Mark Kruger | 6/11/09 1:42 PM
    @Pragnesh,

    I'm glad you brought that up. It is my stated advice that the CF Admin should never be used to alter any JVM settings. There is a long standing issue with the admin that tends to mangle the java.args in such a way that your server will fail on restart. See this post for more info:

    http://www.coldfusionmuse.com/index.cfm/2005/10/28...

    I always recommend editing this file directly rather than through the admin. I wish the admin page wasn't there - then people would perhaps know more about their JVM than just the heap size :)

    -Mar
  • Pragnesh Vaghela's Gravatar
    Posted By
    Pragnesh Vaghela | 6/11/09 1:54 PM
    Thanks for clearing that up
  • David Lakein's Gravatar
    Posted By
    David Lakein | 6/11/09 7:14 PM
    Extra suggestion:

    Make a backup copy of the working jvm.config file before editing :)
    May not be necessary, but you never know.
  • Rob L's Gravatar
    Posted By
    Rob L | 6/30/09 5:16 PM
    Does Adobe recommend any specific versions. Or is it always ok to just the latest version a go?
    On other question... I've still got some CFMX6.1 machines that need to stick around for a while and I'm hoping would benefit from a JVM upgrade. Is there anything specific to 6.1 that I should be aware before upgrading?
  • Mikel's Gravatar
    Posted By
    Mikel | 6/7/13 10:23 AM
    Thank you for this article. I followed it to the T and for the life of me I could not get CF to start! I turns out that the JDK had actually made two JRE directories! Once I pointed the JVM config to the JRE directory buried in the JDK directory it worked like a charm! Anyway, I just thought that I'd add that to the comments here in case anyone else runs into that weird bump!
  • Tom's Gravatar
    Posted By
    Tom | 4/25/15 9:21 PM
    When upgrading JVM, I'm following your directions to the T but I get an error when CF restarts. My log file says, "Error loading: C:\Java\jdk1.7.0_79\jre\bin\server\jvm.dll" but when I copy the path and paste it in the the start > run, I'm prompted to open the dll so I know the file path is correct. In my jmv.config file, my java.home=C:\\Java\\jdk1.7.0_79\\jre (I've tried \\ and // but neither are working. Any advice you can share?