Portable java environments on windows

I always seem to be copying my development environment between PCs and latops which end up being time consuming. Its not the size of the data, its the number of small files (mainly javadoc & java source) that slow the whole process down. I already store the source code and workspace for my clients in a TrueCrypt Volume, to prevent my code being stolen if someone were to get hold of my laptop.

All the other necessary files I need for development; such as libraries, jdk, tomcat/jboss, elcipse etc; are stored on my hard drive. In some cases on different drive letters on different computers. So to simplify this I wanted to store them in a similar way to a TrueCrypt volume but without the overhead of encryption and the hassle of mounting it. After some poking around I remember that Windows 7 came with built-in support for creating and mounting Virtual Hard Disk (VHD) straight from the Storage Manager. The VHD are used by Virtual PC. For those running Vista, Virtual PC 2007 should support this.

For windows 7, you can easily mount an image using the admin interfaces or even create a shourtcut/bat script to mount it. However I wanted the image mounted on start up so it was ready to use. I eventually came across this neat utility (vhdattach) to add shell extension to mount an image with the option to mount at startup. Vista has this alternative.

Now all I need to do to swap PC's is to copy my TrueCrypt volume and my VHD across, mount them on the same letters and done! No need to change paths etc.