FileWriter editing hosts file Mac
Im trying to edit the hosts file on Mac in my program and when I try to edit I get a message:
The code I am using is:
java.io.FileNotFoundException: /private/etc/hosts.tmp (Permission denied)
I am guessing that java does not have permissions to edit the file. Can anyone confirm this for me th/ is there anything I can do?
FileWriter fstream = new FileWriter("/private/ect/hosts", true);
BufferedWriter out = new BufferedWriter(fstream);
out.write("\n126.96.36.199 facebook.com \n188.8.131.52 www.facebook.com\n184.108.40.206 www.facebook.com/home.php?");