• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in renaming a file using java  RSS feed

 
rajashree loganayagi
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wrote a code for renaming a existing file using renameTo().

I have a string "<mid>cbvfjkhgtg<end>
If i found a <mid>tag i need to write the string content "cbvfjkhgtg" in the file.
Once i noticed <end>tag i need to rename the file which was previously written.

The code that i used is :



I cant able to rename the file...

How can i achieve this.....

Please provide the solution ASAP.... Thanks in advance.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you close the DataOutputStream before you rename the file. On some operating systems (Windows, for example) you cannot rename the file while it's open.
 
rajashree loganayagi
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I can able to rename the file after closing the DataOutputStream. Thanks for the guidance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!