Edit read-only file in java <p>I have a protect, read-only, text file on my Linux operating system that I have to make edits to. Of course I can goto the terminal and type:</p> <pre><code>sudo gedit /etc/ppp/options </code></pre> <p>I would then have to type my sudo password. My question is how do I give my java program "sudo" privileges to be able to write to this file and save those edits? I figured once I have given the program these privileges I could then use a BufferedWriter or PrintWriter to make edits.</p> <p>To clarify, my program prompts the user for their administrative (sudo) password. How could I use this to grant access to this file for writing purposes?</p>