ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aalok singhvi <aaloksing...@gmail.com>
Subject Re: WELCOME to user@ant.apache.org
Date Sun, 14 Jun 2015 21:15:11 GMT
Chris..I am on java 6 and upgrading to 7 might be challenging.
On Jun 14, 2015 3:28 PM, "Christopher BROWN" <brown@reflexe.fr> wrote:

> Hello,
>
> Since Java SE 7, URLClassLoader defines a "close()" method which may be
> useful in the specific case mentioned:
>
> http://docs.oracle.com/javase/7/docs/api/java/net/URLClassLoader.html#close()
>
> As for the more general case of Windows locking files from Java, as I
> understand it, it's because the underlying file descriptor use to read from
> or write to files is only release when the associated stream is garbage
> collected (the logic is in the "finalize()" method).  In my own code, I
> have a utility "delete(File)" method that tries to delete the file, and if
> it fails (on a Windows system) will loop with 10 millisecond sleep
> intervals, on the second and last iterations attempting System.gc() to
> force finalization, and it is seems to be a robust workaround in practice.
>
> Hope that might help.
>
> --
> Christopher
>
>
> On 14 June 2015 at 21:15, Stefan Bodewig <bodewig@apache.org> wrote:
>
> > On 2015-06-14, aalok singhvi wrote:
> >
> > > I tried using "deleteonexit" and it is know allowing me to delete
> > something
> > > of the jars but not allowing me to delete 2 directories. It says the
> once
> > > Ant JVM is terminated it can be deleted.
> >
> > This is what I described.  This happens if the JVM has opened the files
> > and closed them again.  For some reason the JVM on Windows and the OS
> > disagree on whether the file is closed, there isn't anything you can do
> > but either ensure the files are never opened in the first place or exit
> > the VM.
> >
> > > Can we terminate ant jvm and restart once this delete is completed. I
> > know
> > > its a stupid question but just wanted to see if you have seen this
> before
> > > by any chance.
> >
> > This would mean you'd need two separate build steps with two separate
> > invocations of Ant.  Something like
> >
> > ,----
> > | > ant update-jars
> > | > ant do-what-I-really-wanted-to-do
> > `----
> >
> > That would probably work.  Maybe you don't need to check for updates all
> > the time?  An in-buildfile way would be to execute Ant from inside Ant
> > using <java fork="true">, but that's not straight forward either.
> >
> > > Let me check if I can extract a small build. i will need to get
> approvals
> > > on that.
> >
> > That would be good.
> >
> > Stefan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message