Why does Java have so much trouble with deleting files

So, I've been doing alot more code on the file-level and have been noticing that Java is really terrible at deleting files. This should be rather straightforward, but the delete method can fail in so many ways, it's unbelievable. Even with taking special care to close all streams, it will sometimes just not do it, or even return a "Yes I've deleted it" result and the file is still there! (deleteOnExit() suffers the same affliction)
This problem is even scuttling the otherwise trusty Ant, which is really annoying. Ever seen this? "BUILD FAILED: Could not delete 'myproject.jar'" So any Ant-driven automated build-and-test process can fail because of this super-avoidable error. (We have to code a pre-build-jar-deletion shell script, which is annoying when jars are added/deleted/renamed for whatever reason.)
Does anyone know the reason for this? I'm really curious.
Maybe, in 1.5, they will come out with "File.crushAndDestroyWithMercilessPrejudice()". I'd use it all of the time! :)

I had the same problem when I was working with JAI. I had about a half million images that I made a viewer for, which would allow our users to do away with microfiche. Project worked great, but the files wouldn't delete off the user box (Win2K). I checked everything and they just would not delete--windows would not acknowlege the resources had been released by Java.
I finally took a lesson from MS developers and said: "It's not a bug, it's a feature!" I wrote it into the manual that it was a cache feature and would speed-up access to the images, yet delete the old ones (which it did, any images that were not accessed during the session would delete just fine, while any that were accessed would still be there next time for local access rather than hitting the network for them. The cache turned out to be one of the great features of the application.
On the other hand, I've not had any problems deleting files from Linux.

Similar Messages

  • Why do I have so much trouble with java?

    I play games on Pogo. Every day it tells me that I need to download Java. It takes a long time to get it to work.

    Java plugins 7u10 or lower are blocked for security. You can download Java v7u11, and see all of:
    https://support.mozilla.org/en-US/questions/944956?page=3

  • Why do I have so much trouble with arrays

    using the following query:
    <cfloop index="loopCompanyNumberSet01Array" from="1"
    to="#arrayLen(companyNumberSet01Array)#" step="1">
    <cfquery name="qrySeriesList" datasource="erpdb01">
    SELECT DISTINCT Left(t_item,2)
    FROM
    dbo.ttiitm001#companyNumberSet01Array[loopCompanyNumberSet01Array]#
    ORDER BY 1
    </cfquery>
    </cfloop>
    I can use cfdump and see that I am getting the results I
    want, but I want to now take them and put them into an array (or
    list) so I can use them for another set of querires
    I tried:
    <cfset seriesArray=arrayNew(1)>
    <cfloop index="getSeriesList" from="1"
    to="#arrayLen(qrySeriesList)#" step="1">
    <cfloop query="#qrySeriesList[getSeriesList]#">
    <cfset seriesArray[currentRow][1]=1>
    </cfloop>
    </cfloop>
    but get error:
    Object of type class coldfusion.sql.QueryTable cannot be used
    as an array

    jkgiven wrote:
    > using the following query:
    > <cfloop index="loopCompanyNumberSet01Array" from="1"
    > to="#arrayLen(companyNumberSet01Array)#" step="1">
    > <cfquery name="qrySeriesList"
    datasource="erpdb01">
    > SELECT DISTINCT Left(t_item,2)
    > FROM
    dbo.ttiitm001#companyNumberSet01Array[loopCompanyNumberSet01Array]#
    > ORDER BY 1
    > </cfquery>
    > </cfloop>
    >
    > I can use cfdump and see that I am getting the results I
    want, but I want to
    > now take them and put them into an array (or list) so I
    can use them for
    > another set of querires
    >
    > I tried:
    > <cfset seriesArray=arrayNew(1)>
    > <cfloop index="getSeriesList" from="1"
    to="#arrayLen(qrySeriesList)#" step="1">
    > <cfloop query="#qrySeriesList[getSeriesList]#">
    > <cfset seriesArray[currentRow][1]=1>
    > </cfloop>
    > </cfloop>
    >
    > but get error:
    > Object of type class coldfusion.sql.QueryTable cannot be
    used as an array
    >
    1) just use qrySeriesList.recordcount instead of your
    arraylen(qrySeriesList)
    2) even better: why use cfloop over query rows when
    <cfoutput
    query="qrySeriesList"> does just that?
    ... oh, i see what you are trying to do now...
    ok, you will have to move the array populating code into your
    first
    cfloop, after the cfquery in it:
    > <cfloop index="loopCompanyNumberSet01Array" from="1"
    > to="#arrayLen(companyNumberSet01Array)#" step="1">
    > <cfquery name="qrySeriesList"
    datasource="erpdb01">
    > SELECT DISTINCT Left(t_item,2)
    > FROM
    dbo.ttiitm001#companyNumberSet01Array[loopCompanyNumberSet01Array]#
    > ORDER BY 1
    > </cfquery>
    move it into here
    > </cfloop>
    3) now, for your array populating script:
    a)
    > <cfset seriesArray=arrayNew(1)>
    that declares a one-dimensional array
    > <cfset seriesArray[currentRow][1]=1>
    but here, i believe, you are populating it as a
    two-dimensional array...
    b)
    > <cfloop index="getSeriesList" from="1"
    to="#arrayLen(qrySeriesList)#" step="1">
    instead of this loop, just use
    <cfoutput query="qrySeriesList">...</cfoutput>
    c)
    > <cfloop query="#qrySeriesList[getSeriesList]#">
    is this the line cf is complaining about?
    you never set your qrySelectList to be distinct queries in
    your first
    loop. with its every iteration that loop just creates a new
    qrySelectSeries, replacing the one created in the previous
    iteration.
    but once you move your array-setting code into the loop, you
    will no
    longer need this loop at all.
    Azadi Saryev
    Sabai-dee.com
    Vientiane, Laos
    http://www.sabai-dee.com

  • Why does Java have such a large footprint?

    I've been curious about this topic for a while, but I haven't ever looked into this to any depth. I also posted this to stackoverflow but haven't gotten any solid responses so far:
    http://stackoverflow.com/questions/1107991/why-does-java-have-such-a-large-footprint
    Java - or at least Sun's Hotspot JVM - has long had a reputation for having a very large memory footprint. What exactly is it about the JVM that gives it this reputation? I'd be interested in a detailed breakdown: how much memory goes to the runtime? (The JIT? The GC/memory management? The classloader?) Anything related to "auxiliary" APIs like JNI/JVMTI? The standard libraries? (Which parts get how much?) Any other major components?
    I realize that this may not be straightforward to answer without a concrete application plus VM configuration, so just to narrow things down at least somewhat: I'm primarily interested in default/typical VM configurations, and in a baseline console "Hello world" app as well as any real-world desktop or server app. (I'm suspecting that a substantial part of the JVM's footprint is largely independent of the app itself, and it is in this part that I'd like to zoom in, ideally.)
    I have a couple of other closely related questions:
    Other similar technology, such as .NET/mono, don't exhibit nearly the same footprint. Why is this the case?
    I've read somewhere on the intarwebs that a large portion of the footprint is due simply to the size of the standard libraries. If this is the case, then why is so much of the standard libraries being loaded up front?
    Are there any efforts (JSRs, whatever) to tame the memory footprint? The closest thing I've come across is a project to reduce the on-disk footprint of the JVM [1] and to modularize the standard library [2].
    I'm sure that the footprint has varied over the past decade or so with every new version of Java. Are there any specific numbers/charts chronicling precisely how the JVM's footprint has changed?
    [1] http://blogs.sun.com/jtc/entry/reduced_footprint_java_se_bringing
    [2] http://blogs.sun.com/theplanetarium/entry/project_jigsaw_modularizing_jdk_7

    yangzhang wrote:
    I've been curious about this topic for a while, but I haven't ever looked into this to any depth. I also posted this to stackoverflow but haven't gotten any solid responses so far:
    http://stackoverflow.com/questions/1107991/why-does-java-have-such-a-large-footprint
    Java - or at least Sun's Hotspot JVM - has long had a reputation for having a very large memory footprint. What exactly is it about the JVM that gives it this reputation? I'd be interested in a detailed breakdown: how much memory goes to the runtime? (The JIT? The GC/memory management? The classloader?) Anything related to "auxiliary" APIs like JNI/JVMTI? The standard libraries? (Which parts get how much?) Any other major components?
    Presumably versus some other VM. I would suppose the fact that much of the VM is written in java has something to do with it.
    I realize that this may not be straightforward to answer without a concrete application plus VM configuration, so just to narrow things down at least somewhat: I'm primarily interested in default/typical VM configurations, and in a baseline console "Hello world" app as well as any real-world desktop or server app. (I'm suspecting that a substantial part of the JVM's footprint is largely independent of the app itself, and it is in this part that I'd like to zoom in, ideally.)
    I have a couple of other closely related questions:
    Other similar technology, such as .NET/mono, don't exhibit nearly the same footprint. Why is this the case?
    Not sure I agree with that. What size do you see with a .Net app that uses 3.0/3.5?
    I've read somewhere on the intarwebs that a large portion of the footprint is due simply to the size of the standard libraries. If this is the case, then why is so much of the standard libraries being loaded up front?
    Good question. There is a feature that allows multiple VMs to use the same memory footprint version of the loaded libraries. That is a new feature and it isn't clear to me if it covers the entire API. I do not know if that is dynamically built.

  • Why am I having so much trouble with my iPad air 2 reading and remembering my fingerprints?

    Why am I having so much trouble with my iPad air 2 reading and remembering my fingerprints? Even if I enter the same finger 5 times, it only works once or twice.

    Try this -> http://m.facebook.com
    which is the mobile optimized page of FaceBook.

  • I have so much trouble with the plug in part of the program I want to disable this in Mozilla. I have to go to windows explorer to get around this plug in problem with Mozilla.

    # Question
    I have so much trouble with the plug in part of the program I want to disable this in Mozilla. I have to go to windows explorer to get around this plug in problem with Mozilla

    Depending on the CSS, live view and design view can be totally different.
    Its often best to type in your copy in the divs and then add the CSS to format it.
    Post the css and the set of divs with some content in order to enable people to try work out what is wrong.

  • Does anyone else have this much trouble with Verizon Customer Service?

    I cannot get any Verizon Customer Service to answer me through email or correct their errors through their store or through the telephone customer service.  I have written to them three times with no reply back (although it says it will be answered within 48 hours), gone to the Verizon local store, and called them numerous times.
    Ever since I purchased three i-pads for my sons as Christmas gifts my life has been nothing but stress while dealing with Verizon and Best Buy while trying to get a jet pack added to our account through Best Buy and trying to straighten the mess out through Verizon. 
    My bill is so messed up, of course in their favor, and they cannot seem to figure out how to fix it or else they don't want to take the time to fix it.
    I own my own business and they should know that you NEVER just IGNORE the customer.  They eventually do go away (to another company).  When a company will not ANSWER complaints...there IS a problem!  I am taking the next channel up.

    This is what happened.  I bought the three i-pads at Best Buy because that is where we buy all of our computer products and it didn't occur to me to buy them at Verizon...Hence, that is why it went through a third party.  Later, I found out I would have paid a much higher price, according to a Verizon salesperson,  so I am glad that I didn't.  But anyway...I bought two jet packs with the three i-pads because I didn't think two of my kids had internet connection so of course, I wanted them to be able to use the i-pads when they opened their gift on Christmas.  I have a business account with three smart phones already with Verizon.  The Best Buy salesman attempted to put the two jet packs on my business account, but he said they would not transfer on that account because it was a business account, so he had to open a new individual account and that Verizon would transfer it over to my business account.  Right then, I could see dollar signs.  That is why I went to the Verizon store the next morning (Christmas Eve) to straighten it out before letting it go on any longer.  I explained everything to the sales person and he assured me that he fixed everything.  I explained to him that I wanted to add the two jet packs on to our account...and for them to share our 6 GB of DATA at the present time until we could see how much we used first.    Seems that one of my sons did have internet and he didn't need the jet pack.  I called Verizon and was told to return it to Best Buy and I would not be charged for it since there was NO USAGE of data on that jet pack. We returned that jet pack.  HOWEVER, the wrong jet pack was cancelled.  So the one that was taken back was not cancelled through Verizon (it remained active) and the jet pack that we kept had no service and was cancelled.  Was that Verizon's fault? Or was it Best Buy's fault?  I don't know...but it was not my fault!  My son lives out of town and he had to bring his jet pack in to Best Buy in order to get service on his jet pack reinstated.  So therefore, he went a week without service, yet we were still being charged for two jet packs...$ 50.00 PER jet pack plus they tagged on 5 GB PER jet pack, which is not what we signed up for.  The charge should be $ 20.00 per month to add the jet pack on to our business account.  We are aware that we can contact Verizon *611 to talk to an agent because we have talked to them approximately five times already.  I have emailed them three times with no reply.  I have never had a problem before this, but I never had any issues so never had a reason to contact them or deal with customer service before.  Jimfitzgerald...the reason people deal with a third party is that it saved us $300.00 from Verizon's price and we purchased these for 18 months with no interest.  Had I known that Best Buy and Verizon do not work well together, I might not have ever bought these at all...But we have one jet pack now that we added to our account and still are being over charged for the two jet packs @ 50.00 per jet pack @ 5 GB data each...totally ridiculous.  My son tried to straighten it out and was told by Verizon that we had one of the jet packs since 2011 and the other one since December 2012.  Finally, Verizon said they understood and would straighten it out...But our bill is still wrong.  How do you get them to answer your complaints?  How do you get them to understand?  If I don't pay our incorrect bill, they told me they will cut off our service and they are our business phones.  Suggestions?

  • Does Revel have a backup retention for deleted files in the cloud and what is the encryption level it uses both end-to-end and locally?

    I'm interested in the premium version of this service however I'd like to know if:
    1. Revel has any kind of cloud backup feature for accidentally deleted files.
    2. What encryption strength does it use for it's end-to-end transfers and also for the local app and cloud storage
    3. Does it have 2 stage authentication?
    I ask because I need something picture friendly but is also HIPAA and SEC compliant.
    thanks!

    Hi nick2048,
    We take security and privacy very seriously and send all communication over encrypted channels.
    However, as a consumer photo site that supports user sharing, it is not our goal to achieve HIPAA certification
    Hope this helps!
    Glenyse

  • Why does my iPhone 5 have so much trouble with network connections?

    My iPhone 5 cannot hold a consistent network connection. It jumps all over the place. Back and forth from 4G (att 3G) to EVDO to nothing. I am in areas where my old iPhones have had no problems. I drop calls and have failed downloads everyday. Not what i expected...

    I live in NJ. I've had every version of the iPhone. iPhone 5 is the worst. Or is it that AT&amp;T is the worst?  I'm still trying to decipher if the problem is the phone or the AT&amp;T network. At times I'll have no bars. My iPhone 5 will go from no bars to the Edge network or vice versa. And I'll have to shut the phone off &amp; turn it back on just to get the bars &amp; 4G back. I don't use the LTE because it drains the **** out of the battery. Another thing I've noticed is that I don't get all my text messages &amp; voicemail notices, at times, hours late. This is very frustrating since I haven't had this problem with any other iPhone that I ever owned.  Please help! SIM card change before exchanging the iphone out? PLEASE HELP!

  • Why do I have so much trouble syncing?

    This is really starting to get on my nerves. I bought this iPhone because of all the cool stuff it can do and because it was supposed to be more reliable "because it's Apple." So far, I've had fewer complaints about the copy of Windows 7 that I bought around the same time. I never thought I'd say this but after about 9 months I'm more pleased with my purchase from Microsoft than I am with my purchase from Apple.
    Anyways, onto my real problem...
    Nearly every time I try to connect my iPhone I have to plug and unplug the USB cable several times before it finally gets recognized in iTunes. Just now I tried at least a dozen times before trying restarting both my computer and iPhone. When that didn't work I tried reinstalling iTunes. It synced this time, but on the second try so the problem isn't solved.
    What happens when I plug it in is the phone will make the sound it makes when you plug it in and it charges but it never goes on to say, "Sync In Progress." iTunes hangs for about a minute and then gives up trying to recognize it. If it does eventually work, iTunes loads the phone's contents quickly.
    Because of this issue I'm also wary of updating to iOS 4.0.2 as it could cause problems during the update process.

    @stellarwill
    "iTunes hangs for about a minute and then gives up trying to recognize it."
    @dosk
    Why would you post your question in my thread instead of making your own? Your problem is completely different.
    @shadowbeast
    I didn't think it was necessary to post my computer's specs but if you think it will help, these are them:
    Intel Core i7-920
    Asus P6T mobo (which is the Intel 1366 chipset)
    Mushkin 6GB Triple Channel DDR3
    WD 1TB 7200RPM SATA HDD
    ATi Radeon 5750
    Creative X-Fi XtremeGamer
    I built my computer by hand so I can't just call someone and play tech support tag getting transferred back and forth between Apple and the computer manufacturer. Problems like this never get solved by tier 1 tech support anyway.
    Could you link me to an article describing these faulty chipsets? I've never heard of anything like this.

  • Why do I have so much trouble signing-in to Itunes?

    Everytime I try to sign-in to ITunes, I always get the error that my ID/Password are incorrect. I wrote them down when I had trouble the last time but still cannot log-in to ITunes.
    If I click Forgot Password then the button for answering security questions, when it asks for my date of birth, when I put that in it is wrong. Geeeze!!! I ought to know when I was born and why would I enter something different?
    Getting so I don't want to mess with ITunes or Apple, period!!

    Here's an update on my post.
    When I click on my ITunes short cut, I get a window that says
    I have no idea why I'm getting this error as I have not inserted a disc in my computer for months. I haven't created any playlists, nor have I purchased anything as I'm always denied.
    In addition, when I am logged-in to the store (I'm assuming I am logged-in as my email address is reflected on the top left), when I select a song, then click Buy, I get the following error
    I'm at a total loss as to why I am unable to do anything in ITunes, either through my desktop or IPhone. Quite obviously I don't have a network problem as I have to be on-line to even get into the ITunes store.
    At this point, I'm convinced that ITunes doesn't want my money and am at the point that I'll just forget Apple and ITunes and try my luck elsewhere.
    FYI. I have used two emails, and created 2-3 IDs/passwords trying to get into ITunes and buy something.

  • Why do I have so much trouble loading Frontierville, and why do I have to refresh it so much?

    When I go to load Frontierville, it takes forever; then when it finally does load, I no sooner get started then it tells me that the internet went all quiet and to refresh my page. What can I do to fix this?

    Here's an update on my post.
    When I click on my ITunes short cut, I get a window that says
    I have no idea why I'm getting this error as I have not inserted a disc in my computer for months. I haven't created any playlists, nor have I purchased anything as I'm always denied.
    In addition, when I am logged-in to the store (I'm assuming I am logged-in as my email address is reflected on the top left), when I select a song, then click Buy, I get the following error
    I'm at a total loss as to why I am unable to do anything in ITunes, either through my desktop or IPhone. Quite obviously I don't have a network problem as I have to be on-line to even get into the ITunes store.
    At this point, I'm convinced that ITunes doesn't want my money and am at the point that I'll just forget Apple and ITunes and try my luck elsewhere.
    FYI. I have used two emails, and created 2-3 IDs/passwords trying to get into ITunes and buy something.

  • Why do I have so much trouble getting my copy to format correctly inside my div?

    Hey guys, I'm very new at this so please bear with me   I'm designing my first website and I'm at the point where I want to add my copy.  I have a div with a background image, and another div nested inside of it.  When I paste my copy into the nested div, things seem to shift around in the design view.  They usually look ok when I preview in live mode, but it's very troublesome trying to work on the site when things are all jumbled up.  What am I doing wrong?  Should I paste the source code here so you guys can see it?  Thanks in advance!

    Depending on the CSS, live view and design view can be totally different.
    Its often best to type in your copy in the divs and then add the CSS to format it.
    Post the css and the set of divs with some content in order to enable people to try work out what is wrong.

  • Why does Mail have a difficult time with ATT Uverse?

    I anyone having a problem with Mail interacting with the ATT Uverse servers?

    Just had U-Verse installed at home and had problems sending email from Apple Mail. Receiving mail was not a problem; just sending. It worked fine with our previous provider Time Warner. Entering the SMTP server name, which was all we had to to do with Time Warner, did not work. We called AT&T and they said that they would fix it for a fee (talk about bad profits, right?).
    Anyways, we finally got it to work and hopefully this helps resolve your issue. Here's what we did:
    1. Log in to Yahoo! with your att.net email account that came with your AT&T subscription.
    2. Once logged in, add the non-AT&T email addresses you use on Apple Mail (e.g., work email, personal mail, etc.). These additions have to be verified so check the confirmation email from U-Verse using web-based email services (e.g., mail2web.com) and click on the links.
    3. Once you've added your other emails (AT&T calls these sub-accounts) to your att.net email account, go to Apple Mail on your MacBook and add your att.net email account. Just follow the onscreen instructions and Mail will set everything up, including the SMTP server name, etc.
    4. Send a few test emails from your non-AT&T email accounts to check if they are going out and getting sent.
    That's it. It's been a couple of days and it seems to be working fine.
    By the way, if you've got an iPhone, simply add your AT&T email account (under Settings/Add Account, choose Other) and now you should be able to send/receive from your non-AT&T email accounts.
    Hope this helps. If it does, spread the word. No one should have to pay AT&T for something that should easily work. The least AT&T can do is make sure the information to fix the issue is readily available and easily discoverable on their site. By the way, when we called them, they said that they could only support att.net email accounts, hence the fee. Hello?

  • Is anyone have as much trouble with Adobe Acrobat XI as I am?

    Everytime I open the new CS 6 Adobe Acrobat XI it freezes or crashes.  I have to open it in the "no plugins" mode with the shift key but this can't be the way the program was designed, is there a fix for this?

    What OS? Crashes are frequently caused by bad fonts or hardware issues. If you have any video acceleration set on your display under Windows see if you can turn it off.

Maybe you are looking for