Okay i have this website, (Project Quattro - Home), and i have uploaded a file to it (http://www.projectquattro.webs.com/java/javaarray.txt). i have entered some text into it and i can read that text perfectly but i'm having problems trying to write to it! here is what i have:
package Alpha_1; import java.io.*; import java.net.*; /** * * @author Ollie */ public class NewEmpty { NewEmpty(){ String nextLine; URL url = null; URLConnection urlConn = null; InputStreamReader inStream = null; BufferedReader buff = null; OutputStreamWriter out = null; try{ url = new URL("http://projectquattro.webs.com/java/javaarray.txt"); //have tryed: http://projectquattro.webs.com:80/java/javaarray.txt urlConn = url.openConnection(); urlConn.setDoOutput(true); urlConn.setAllowUserInteraction(true); urlConn.connect(); out = new OutputStreamWriter(urlConn.getOutputStream()); out.write("Hello Ollie"); out.close(); }catch(MalformedURLException e){ System.out.println("Please check the URL:" + e.getMessage()); }catch(IOException ex){ System.out.println("Can't write to the Internet: " + ex.getMessage()); } //i read from the file here but it just show what is originally there not what i have tried to write to it! } }