This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Replace a file using java

 
An Sush
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a file which i want to replace with another one. Say /opt/IBM/installedApps/WebApplication.ear is to be replaced by /root/Desktop/NewFile.ear. Is there simple File operation to do so?
Or the only way is to delete the existing file, create a new file with the same name and read byte by byte from NewFile.ear and write in the newly created file?
 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you try that did not work?

Just Check out the Java File Io and you'll find API which could work with both the approaches that you mentioned!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic