<p>I'm switching between different Java SDKs (1.4.2, 1.5.0 and 1.6.0) for various projects.  I would like to set the JAVA_HOME environment variable on my Windows XP machine without going through the tedious My Computer -> Advanced -> [Select System Variable] -> Edit -> Ok -> Ok</p>

<p>Is it possible to do this from the command line, or is there a utility that can do this?</p>

<p>(Note that I am not referring to the standard batch file "SET" command - I want to set the environment variable "globally," not just for the life of a console window).</p>

From
http://vlaurie.com/computers2/Articles/environment.htm
:
Using the add-on tool Setx.exe
It is not part of the standard Windows
  XP setup but a command-line tool
  called setx.exe is included in the
Windows XP Service Pack 2 Support Tools
. This tool extends the set
  command so that permanent changes in
  the environment variables can be made.
  For example, to add a folder C:\New
  Folder to the path, the command would
  be setx path "%PATH%;C:\New Folder"