Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Replace a file using java

 
An Sush
Ranch Hand
Posts: 47
  • 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
  • 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