in the current user’s home directory. This is often not a good choice for a Windows installation. When
running Jenkins on Windows XP, you should avoid installing your Jenkins home directory anywhere
near your C:\Documents And Settings directory—not only is it a ridiculously long name, the
spaces can wreak havoc with your Ant and Maven builds and any tests using classpath-based resources.
It is much better to use a short and sensible name such as C:\Jenkins. The Vista and Windows 7 home
directory paths like C:\Users\john will also work fine.
Figure 3.5. Installing Jenkins as a Windows service
A short home directory path is sometimes required for other reasons, too. On many versions of Windows
(Windows XP, Windows Server 2003, etc.), file path lengths are limited to around 260 characters. If
you combine a nested Jenkins work directory and a deep class path, you can often overrun this, which
will result in very obscure build errors. To minimize the risks of over-running the Windows file path
limits, you need to redefine the JENKINS_HOME environment variable to point to a shorter path, as we
discussed above.
This approach won’t always work with Windows Vista or Windows 7. An alternative strategy is
to use the jenkins.exe program that the Web Start installation process will have installed in the
directory you specified above. Open the command line prompt as an administrator (right-click, “Run as
administrator”) and run the jenkins.exe executable with the install option:
C:\Jenkins> jenkins.exe install
This basic installation will work fine in a simple context, but you will often need to fine-tune your
service. For example, by default, the Jenkins service will be running under the local System account.
However, if you are using Maven, Jenkins will need an .m2 directory and a settings.xml file in the