title: Java - writing to url not working
body: <p>I'm trying to make a java program that changes a text document on my website. The permissions are on that everyone can edit it. I've tried, and reading it works perfectly, but writing doesn't.
  Here's the code for the writing:</p>
  
  <pre><code>import java.net.*;
  import java.io.*;
  public class Main {
      public static void main(String[] args) throws Exception {
          URL infoThing = new URL("http://www.[name of my website]/infoThing.txt");
          URLConnection con = infoThing.openConnection();
          con.setDoOutput(true);
          OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
          out.write("Change to this.");
          out.close();
      }
  }
  </code></pre>