ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13413] New: - ant.bat not computing CLASSPATH correctly
Date Tue, 08 Oct 2002 17:40:04 GMT
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=13413>.
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=13413

ant.bat not computing CLASSPATH correctly

           Summary: ant.bat not computing CLASSPATH correctly
           Product: Ant
           Version: 1.5.1
          Platform: PC
        OS/Version: Windows 9x
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Wrapper scripts
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: polo_talnir@hotmail.com


On Windows 98, the following .bat file statement should work,
but it doesn't:
for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat"
The problem being that the buggy and not very smart MS-DOS shell
of Win98SE can not compute the set ("%ANT_HOME%\lib\*.jar") because
it has a full path name. There might be some settings that make
this work, but these are not the default settings, at least not in
our Win98SE machines here. On the other hand, if you "cd" to
%ANT_HOME%\lib, and then build the set (*.jar) in the current
directory, the set is built correctly. Now the problem becomes how
to "cd" to this directory, build the set of jars with the full path
then "cd" back. This last part is not very trivial in MS-DOS

Here is a batch file segment that does that. Not very pretty, but
nothing can be in MS-DOS ..., and it works:

rem    define the drive where Ant installation exists -- this needs to
rem    be computed, rather than hard-coded, from the ANT_HOME variable.
rem    I don't remember how to do this ...
SET ANTDRIVE=C:

rem    getting current directory and drive letter so that I can "cd" back
rem    -- standard MS-DOS trick: creates a batch file that sets the WORKING_DIR
rem       variable to its 2nd parameter
echo set WORKING_DIR=%%2> directory.bat
rem    -- likewise a "volume" batch file, 3rd parameter
echo set DRIVELETTER=%%3> volume.bat
rem    -- create a batch file that invokes the "directory.bat" created above
rem       this uses the text produced by the "dir" command as the invocation
dir | find /I "Directory of" > invoke1.bat
rem    -- likewise for the "volume.bat"
dir | find /I "Volume in" > invoke2.bat
call invoke1.bat
call invoke2.bat
del invoke1.bat >NUL
del invoke2.bat >NUL
del directory.bat >NUL
del volume.bat >NUL

Yes, this code creates four files to produce what in any 30-years-old
UNIX shell you can do in one line, in memory: WORKING_DIR=`pwd` but
I don't know of other ways to do this in MS-DOS so that it works in
all Windoze OSs. This code was tested on Win2K as well.
Then we can do:
cd %ANT_HOME%\lib
%ANTDRIVE%
for %%i in ( *.jar ) do call "%ANT_HOME%\bin\lcp.bat" %ANT_HOME%\lib\%%i
cd %WORKING_DIR%
%DRIVELETTER%:

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message