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("\n18.104.22.168 facebook.com \n22.214.171.124 www.facebook.com\n126.96.36.199 www.facebook.com/home.php?");