On Windows 98 in an MS-DOS window I'm executing ANT with the following build.xml file: <project name="util" default="clean" basedir="."> <target name="clean"> <echo>${ant.version}</echo> <delete file="util.jar"/> </target> </project> A file named util.jar exist in the current directory and is NOT read only. The file can be deleted from the command line without any trouble. The following is the output from ANT: Buildfile: build.xml clean: [echo] Apache Ant version 1.6.1 compiled on February 12 2004 [delete] Deleting: C:\src\net\nj2dx\util\util.jar BUILD FAILED C:\src\net\nj2dx\util\build.xml:4: Unable to delete file C:\src\net\nj2dx\util\u til.jar Total time: 2 seconds
Do you have "." in your classpath? See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26108 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=28046
. exists in the CLASSPATH DOS environment C:\src\net\nj2dx\util>echo %CLASSPATH% c:\src;. However a CLASSPATH is not defined nor specified within the build.xml file.
Verbose output from ANT in case it helps track down the bug... Apache Ant version 1.6.1 compiled on February 12 2004 Buildfile: build.xml Detected Java version: 1.4 in: C:\J2SDK1.4.2_01\JRE Detected OS: Windows 98 parsing buildfile C:\src\net\nj2dx\util\build.xml with URI = file:///C:/src/net/nj2dx/util/build.xml Project base dir set to: C:\src\net\nj2dx\util Build sequence for target `clean' is [version, clean] Complete build sequence is [version, clean, compile, build, all, usage, ] version: [echo] Using Apache Ant version 1.6.1 compiled on February 12 2004 clean: [delete] Deleting 1 files from C:\src\net\nj2dx\util [delete] Deleting C:\src\net\nj2dx\util\util.jar BUILD FAILED C:\src\net\nj2dx\util\build.xml:14: Unable to delete file C:\src\net\nj2dx\util\util.jar at org.apache.tools.ant.taskdefs.Delete.removeFiles(Delete.java:614) at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:503) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:301) at org.apache.tools.ant.Target.performTasks(Target.java:328) at org.apache.tools.ant.Project.executeTarget(Project.java:1215) at org.apache.tools.ant.Project.executeTargets(Project.java:1063) at org.apache.tools.ant.Main.runBuild(Main.java:632) at org.apache.tools.ant.Main.startAnt(Main.java:183) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56) Total time: 7 seconds
OK now I see the errors of my ways... I removed . from CLASSPATH and ANT can now delete the JAR file. Thanks! *** This bug has been marked as a duplicate of 26108 ***