File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Replace a file using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Replace a file using java" Watch "Replace a file using java" New topic
Author

Replace a file using java

An Sush
Ranch Hand

Joined: Jan 17, 2007
Posts: 47
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

Joined: Feb 08, 2009
Posts: 597

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!


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Replace a file using java
 
Similar Threads
Replacing a string in a byte stream
reading an html
NIO and updating a file region
How to read binary file?
Copy .mdb file and multiple files