I am getting the following when trying to access system variables using <property environment> task: [property] java.io.IOException: Cannot run program "command.com": CreateProcess error=2, The system cannot find the file specified [property] at java.lang.ProcessBuilder.start(Unknown Source) [property] at java.lang.Runtime.exec(Unknown Source) [property] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [property] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [property] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Sourc e) [property] at java.lang.reflect.Method.invoke(Unknown Source) [property] at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.e xec(Execute.java:646) [property] at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:416 Here's a simple ant project that duplicates the problem: <project name="test" default="getenv" basedir="."> <target name="getenv"> <property environment="env" /> </target> </project>
If you really are using 1.5.2 then please note that it is veeery old. It has been released almost eight years ago and we've had thriteen releases after that. It seems you are hitting bug 16611 which has been fixed for Ant 1.6 seven years ago. *** This bug has been marked as a duplicate of bug 16611 ***
Thanks for the info. I figured it was already fixed. My problem is that the system I am working with has ant pre-installed and upgrading is not an option. Anyway, I will read the bug 16611 for any workarounds.
If I'm correct and it really is a duplicate of bug 16611 then you are running on a Windows version that is newer than XP or 2003 (the latest versions known to Ant 1.5.2) and Ant thinks it is a win9x system. A workaround would be to set the os.name system property to something recognized as "Windows with cmd.exe rather than command.com" by Ant. "windows 2000" should work.