Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes How to replace a word in a file with another. 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 » Java in General
Bookmark "How to replace a word in a file with another." Watch "How to replace a word in a file with another." New topic
Author

How to replace a word in a file with another.

pradeep kumar rama
Greenhorn

Joined: Apr 26, 2007
Posts: 3
Hi, can anyone tell me the code to replace a word in a file with another. Eg. The code should be able to replace all the occurences of the word "java" ina file to "j2ee".
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

Hi Pradeep,
...the code to replace a word in a file with another...


May be you can try this link

Text Replacement
pradeep kumar rama
Greenhorn

Joined: Apr 26, 2007
Posts: 3
Hi Chandra. The url you sent me solved my problem. Many Thanks for your reply. Also can we have any means by which we can do it without using the replaceAll or any other inbuilt function ?
 
jQuery in Action, 2nd edition
 
subject: How to replace a word in a file with another.
 
Similar Threads
can we typecast String to String array
invalid LOC header - How to overcome this Exception?
How to read and modify MS word using Java
Replacing a word in a text file
String replacer