CF7, CF8, Jrun and the JVM
As I mentioned in this post, I described, briefly how my development environment is set up, and how I installed ColdFusion 8 onto the same JRun server where I have ColdFusion 7 installed. A reader inquired about the JVM and if there are any conflicts. Well, the answer is no, there are not. Why? Well, becasue when you deploy ColdFusion 8 as a .ear file onto a server running ColdFusion 7, JRun will use the JRE specified in the java.home variable in {jRun root}/bin/jvm.config, which in my case was 1.4.2_09.
Now, I have been running this configuration since the public beta and have not run into any issues with performance, or even errors occurring when running ColdFusion 8 code. However, I wanted to set-up my ColdFusion 8 to use the same JRE it would if I had done a different install (stand alone, or multi-server). This was easy enough as you can create custom jvm.config files and use them to run your JRun ‘servers’.
Here’s to do it.
Disclaimer: This is for Windows only. I assume the procedure would be similar in a different environment.
- Download the latest Java SDK and install it. (You may be able to use the JRE alone, but I didn’t test this)
- Make a copy of jvm.config (located in {JRun root}/bin } and name it jvm_cf8.config. (You can name it whatever you would like, but the rest of the instructions assume you use this name)
- Change the java.home variable from “C:/JRun4/jre” (It may be different for you) to {new SDK Install path}/jre and save the file.
- If its running, stop the ColdFusion 8 service.
- Open a command window and “cd” to {JRun Root}/bin
- Test the new config by typing jrun -config jvm_cf8.config -start {the name of your ColdFusion 8 server in Jrun}. If you don’t get any errors, you can now set up your Windows service to use this config file.
- Pressing crtl+c should shut down the JRun server you just started.
- Type the following to remove the windows service jrunsvc -remove {the name of your ColdFusion 8 server in JRun}
- Now you need to reinstall the Windows service and tell it to use the new config jrunsvc -install {the name of your ColdFusion 8 server in JRun} -config jvm_cf8.config.
- You should now be able to start ColdFusion 8 from the Services MMC in Windows.
To verify you are using the updated JVM, log into the ColdFusion Administrator for ColdFusion 8 and go to ‘System Information’ (It’s the blue icon on the top right side of the page) and check the JRE and JVM values.
UPDATED: As noted by Andy Allan in a comment below, when you copy jvm.config and update the java.home variable, you also need to update the java.library.path variable as well. This variable should point to you new instance of ColdFusion. He also warns to be careful with pathing to the new instance as there may be some subtle differences between the new instance, and the ‘default’ instance.