• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

file renaming...

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a file, already on the hard drive (basicCustomerInfo) and another file (rewritten) which I'd like to rename to basicCustomerInfo, getting rid of the original basicCustomerInfo file and replacing it with the contents of rewritten. It doesn't rename it and replace the contents. I saw that trying to rewrite a file while input and output streams are open is a common problem, so I made sure they were all closed properly. It still doesn't rename with the new contents. Does anyone have any idea what I might be doing wrong?


[ March 20, 2006: Message edited by: Brandi Love ]
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible that the file might still be in use somewhere else?
 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That doesn't seem to be the case, I closed everything. I checked the other code I wrote that uses these files but I've closed all the input and output, as far as I can see. Could it be possible that the file is in use within another class and that is causing the problem? Maybe I'm missing something...

Here's the code that I wrote, I bolded the relevant stuff.


[ March 20, 2006: Message edited by: Brandi Love ]
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might also try closing the FileReaders. I'm not sure if that will fix it, but it might.
 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tried closing everything, still gettin' the error.



I'll try playing around and testing it, there must be something I'm missing somewhere.
reply
    Bookmark Topic Watch Topic
  • New Topic