Bug 29066 - Unable to delete JAR file
Summary: Unable to delete JAR file
Status: RESOLVED DUPLICATE of bug 26108
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.1
Hardware: PC All
: P3 major with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-18 17:00 UTC by Tom Kenny
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Kenny 2004-05-18 17:00:31 UTC
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
Comment 2 Tom Kenny 2004-05-18 17:10:59 UTC
. 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.
Comment 3 Tom Kenny 2004-05-18 17:19:26 UTC
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
Comment 4 Tom Kenny 2004-05-18 17:28:18 UTC
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 ***