Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
Jar Locking

Jar Locking

2006-08-30       - By Marc Farrow
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

Everytime I run an ant task (either in NetBeans or from within Java Code),
the executing jar gets locked and I cannot delete the jar.  I am copying the
ant script and the dependent jar that it needs to run and then executing the
ant tasks.  Then I wish to delete the "new" copy I just created to run, but
a jar I am using is locked and will not allow me.  This in on a Windows 2000

Steps to recreate problem in NetBeans:
1) Create a new Java Application that extends Ant and creates a Jar or even
uses an existing one such as ant-contrib.jar.
2) Run an the new ant task from within the build script of another project
(via import command).
3) Delete project created in step 1).
4) Go to windows explorer and try to remove rest of sources, etc from the
folder that the project in step 1) was created in.

Steps to recreate similar problem using Ant Programmatically.
  (All actions happen within same instance of a java class).
1)  Check out favorite project from your favorite source control
2)  Programmatically call the Ant script and build the project you just
checked out.
3)  Once build has completed (and with no errors) try to delete the project
you just checked out.

Anyone have any suggestions to keep the "jars" from being locked after
execution of the Ant script?

Thank you,


Marc Farrow

©2008 - Jax Systems, LLC, U.S.A.