Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error writing to URLConnection

807605Aug 12 2007 — edited Aug 13 2007
Hi I get I'm trying to write to a text field using URLconnection but I'm getting an error.
        URL yahoo = new URL("http://web.telia.com/~u87018087/Tester.txt");
        URLConnection yc = yahoo.openConnection();
		OutputStreamWriter out = new OutputStreamWriter(yc.getOutputStream());
	    //out.write("string=" + "Hej");
	    out.close();
an I get this error message:
java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true)
And if I use that method I get this error instead:
java.io.IOException: Server returned HTTP response code: 405 for URL: http://web.telia.com/~u87018087/Tester.txt
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2007
Added on Aug 12 2007
3 comments
483 views