[Solved] Java realtime writing file when it’s opened


Interesting:

Lets deal this in simple way.

1. Save a file test.txt somewhere. 
2. Open that file and keep it opened

In Java write to this file (Standard Code)

FileWriter fw = new FileWriter(new FileOutputStream(new File("c:/test.txt")));
fw.write("ABC")

Now go to notepad file again. I normally used Textpad it does refresh automatically (by an alert) because we changed it behind the scene (In your case through Java).

I hope that will clarify a bit.

To be fare trying to excess the genric notepad exe doesn’t gurrantee which file you will write in. I am not sure how windows deal with it because you can open 3 different files at one time and which one you will expect to have your data written through java???

solved Java realtime writing file when it’s opened