Monthly Archives: October 2007

Symlinks for Windows

One of the handiest things I learned at No Fluff Just Stuff this weekend was from Neal Ford, who showed a way to set up soft links (symbolic links, symlinks, it’s all the same idea) in Windows. This allows you to install different versions of JDKs, Tomcat, Groovy, Grails, JRuby, whatever, and use the latest version without having to change anything but your symlink.

For example, you can install Groovy 1.0 into c:\sw\groovy-1.0. Then create a symlink at c:\sw\groovy that points to c:\sw\groovy-1.0. Set up your GROOVY_HOME and your Path to also point to this symlink. Now, when Groovy 1.1 comes out, you install it in c:\sw\groovy-1.1. Then, simply change your symlink to point to c:\sw\groovy-1.1, and you’ve got an instant, machine-wide upgrade! If anything goes wrong, you can easily change the symlink back to the 1.0 version, and everything goes back to the way it was before.

This is the kind of thing that Unix, Linux, and Mac users have been doing for years. The one drawback to the Windows version is that you can only symlink to directories, not to individual files. Not the end of the world, but a limitation to be aware of.

You can download the free utility from the great SysInternals site, where you can find dozens of other brilliant, free utilities. The symlink utility is called Junction and can be downloaded here.