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("\n184.108.40.206 facebook.com \n220.127.116.11 www.facebook.com\n18.104.22.168 www.facebook.com/home.php?");