DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15351>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15351 JAVA_HOME set to path with spaces causes ant.bat to fail Summary: JAVA_HOME set to path with spaces causes ant.bat to fail Product: Ant Version: 1.5.1 Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: Wrapper scripts AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If you have JAVA_HOME set to a path with spaces, ant.bat will build a classpath that confuses java at the following lines: ---------- if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\tools.jar" if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\classes.zip" ---------- In lcp.bat, the first line reads: set _CLASSPATHCOMPONENT=%1 Since the parameter was passed to lcp.bat quoted, it gets added to the classpath variable quoted like this: ---------- "C:\Program Files\j2sdk1.4.1_01\lib\tools.jar";O:\Dev\ProTools\Apache Ant\bin\..\lib\xml-apis.jar;O:\Dev\ProTools\Apache Ant\bin\..\lib\xercesImpl.jar;O:\Dev\ProTools\Apache Ant\bin\..\lib\optional.jar;O:\Dev\ProTools\Apache Ant\bin\..\lib\ant.jar; ---------- For some reason, the quoted part works if it doesn't have spaces. If it does have spaces you get this: ---------- Exception in thread "main" java.lang.NoClassDefFoundError: Files\j2sdk1/4/1_01\lib\tools/jar;O:\Dev\Tools\Apache Ant\bin\//\lib\xml-apis/jar;O:\Dev\Tools\Apache Ant\bin\//\lib\xercesImpl/jar;O:\Dev\Tools\Apache Ant\bin\//\lib\optional/jar;O:\Dev\Tools\Apache Ant\bin\//\lib\ant/jar; ---------- I believe the correct fix (at least on NT/2K/XP) for this is to change the first line in lcp.bat to read: set _CLASSPATHCOMPONENT=%~1 The ~ tells the command interpreter to strip enclosing quotes if they exist (and do nothing if they don't). -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>