9 Replies Latest reply: Sep 14, 2006 9:26 AM by 807569 RSS

    Open and modify an existing file in java

    807569
      Supposed I have a file called myfile.txt, its content is below:

      XYZT.....
      .............
      ...keyword: mykeyword

      ABCD.....

      I would like to open it, go to the "keyword", modify the string "mykeyword" to "changedkeyword" then save the file. Note that I want to save the change to the file, not to create another file. What should I do?

      Now I know many of you will suggest me reading I/O classes. I know I/O classes but still couldn't find what I want. A simple source code would be great.