If you are developing a ColdFusion application, or even just a stand alone CFC that you plan to distribute, you might want to make sure it runs on all three major CFML engines – Adobe ColdFusion, Railo, and Open BlueDragon. It can be tedious to always copy code around between your three test sites, but there is an easier way. You can have the same code base run through all three CFML engines at once.

There are a few caveats:

  1. You must be using Tomcat as your J2EE server (I think you can probably do this with JRun if you are using the J2EE/multi-server version of ColdFusion, but I have only done it using Tomcat)
  2. You must run your code from a subdirectory. That is, if your local test site is setup like http://localhost:8080/openbd, you will run your code from http://localhost:8080/openbd/<a subdirectory>/

I’m not going to go through setting up Tomcat or Railo/OpenBD/AdobeCF, see this great blog post by Matt Woodward if you need help with that.

Once everything is setup, you should have three separate webroots, probably something like:

Now create a subdirectory in one of those directories, lets just take the first one, railo. Call the new subdirectory “shared”. Now comes the trick, we will use a junction to make subdirectories named “shared” in openbd and cfusion, but really they just point to the shared directory under railo. This “junction” is a feature of the NTFS file system and works much like a symbolic link on Linux.

If you are running Vista, Windows7, or Windows 2008 you already have a built in tool to create a junction called “mklink”. Otherwise if you are running WindowsXP or Windows2000/2003 you need to download Junction v1.05 from Microsoft’s site. Its a sysinternals tool, if you aren’t familiar with that group, they made lots of great techy tools for Windows. You can get it from here: http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx.

Download the zip file and extract the single .exe file that is inside it. This is a command line tool so I placed it into my C:\windows\system32 directory so it would be in my path and can be run from any command prompt. Now open up a DOS command prompt, and change into your railo webroot. Then create the two junctions named “shared” that point back to the real “shared” directory.
command prompt - junction

Now we have this folder structure, where “shared” is really the same folder in each location.

folders - junction example

Just drop your files into there and then you can hit them using the three separate URLs you used when setting up Tomcat. I use railo.dev, openbd.dev, and cfusion.dev as my hostnames.

If you are on an OS that has the mklink command, the syntax is a little different.
windows7 command prompt

Note how on Windows7 the DIR command is smart enough to recognize that the folder is actually a junction and shows me where it is linked to.

The folder looks a little different in Windows Explorer, too. Unfortunately it looks just like a shortcut, which it certainly is not, but at least you can tell its not a regular folder.

I have this setup on both of my main development machines, and find it very convenient to be able to run my exact same code through all 3 CFML engines just by changing the URL. I usually keep three browser windows open as I develop so I can easily test stuff on all 3.


  1. scott conklin says:

    Nice Posts and very interesting. i was wondering though if it were possible to take it a step further and make your hosts names , in your case railo.dev, openbd.dev, and cfusion.dev  all render content somehow outside of the context of one of the installed engines. (somehow having the shared subdir refer back to a different context root)
    i am still looking for away to do what you are doing, but have the docbase be wwwroot dir for example where i have all my projects.

  2. Mike Henke says:

    Magic Junction is another tool for creating junctions.  The interface is nice and simple. http://www.rekenwonder.com/linkmagic.htm Works on a wide range of windows versions.