views:

146

answers:

1

A server was upgraded from Windows 2000 to Windows 2003 and now I can't access environment variables from Ant build scripts.

I can still access them fine from a command line, but ${env.JAVA_HOME} for instance fails.

How can I fix this without rewriting ~100 build scripts that work on all other servers to be customized for this server?

A: 

Unfortunately I don't think you should have been using that environment variable. To get around such problems there's the builtin ${java.home} you could have been using, which isn't dependent on the operating system and/or user's environment being setup properly. (See the Ant manual discussion of built-in properties in Ant.)

You may be able to get around rewriting all your build scripts by either (1) setting the JAVA_HOME environment variable manually, or (2) modifying the ant.bat file to assign it manually. Both options are brittle because they'll break when Java gets upgraded, but at least they'll likely fail fast.

Chris Winters
That is merely one, we use TOMCAT_HOME, WL_HOME, JALOPY_HOME and many others that aren't inbuilt.
Tristan