Bug 43971 - ant.bat execution fails if CLASSPATH ends with double-quotes
Summary: ant.bat execution fails if CLASSPATH ends with double-quotes
Status: RESOLVED WONTFIX
Alias: None
Product: Ant
Classification: Unclassified
Component: Wrapper scripts (show other bugs)
Version: 1.7.0
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
: 41622 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-27 02:25 UTC by Dimitri Hautot
Modified: 2014-01-08 13:56 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitri Hautot 2007-11-27 02:25:17 UTC
If the CLASSPATH environment variable ends with a " (double-quote character),
then the Ant scripts will not work; the error message is "The syntax of the
command is incorrect.".
This is due to the line 82 in the script file ant\bin\ant.bat:

if not _%CLASSPATH:~-1%==_\ goto findAntHome

Indeed, variable expansion+manipulation here results in this:

if not _"==_\ goto findAntHome

which obviously breaks the syntax of the shell.

A quick fix is
* either to remove the double-quote characters around the last CLASSPATH entry
* or to add an additional semi-colon ( ; ) character at the end of your
environment CLASSPATH value
Comment 1 Steve Loughran 2007-11-27 02:35:13 UTC
we know this, but we also dont see an easy way to detect and fix it in ant.bat;
it is in the category of 'system specific configuration errors', I'm afraid. 

There is no need whatsoever to have double quotes in the CLASSPATH variable.
Really. If you have them, delete them. Ideally, you shouldnt use CLASSPATH at all.

marking as WONTFIX, though it is actually CANTFIX.
Comment 2 German Gonzalez 2014-01-08 13:56:33 UTC
*** Bug 41622 has been marked as a duplicate of this bug. ***