Bug 50542 - Getting java.io.IOException when trying to use property environment
Summary: Getting java.io.IOException when trying to use property environment
Status: RESOLVED DUPLICATE of bug 16611
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5.2
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-04 22:22 UTC by t3knoid
Modified: 2011-01-05 10:53 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description t3knoid 2011-01-04 22:22:31 UTC
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>
Comment 1 Stefan Bodewig 2011-01-05 03:53:30 UTC
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 ***
Comment 2 t3knoid 2011-01-05 09:45:49 UTC
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.
Comment 3 Stefan Bodewig 2011-01-05 10:53:39 UTC
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.