Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 33625 invoked from network); 13 Dec 2002 11:49:53 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 13 Dec 2002 11:49:53 -0000 Received: (qmail 24624 invoked by uid 97); 13 Dec 2002 11:50:58 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 24604 invoked by uid 97); 13 Dec 2002 11:50:57 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 24593 invoked by uid 50); 13 Dec 2002 11:50:56 -0000 Date: 13 Dec 2002 11:50:56 -0000 Message-ID: <20021213115056.24592.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: ant-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 15351] New: - JAVA_HOME set to path with spaces causes ant.bat to fail X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . 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: ant-dev@jakarta.apache.org ReportedBy: ron.baldwin@sourceprose.com 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: For additional commands, e-mail: