Writing to a File If the file does not already exist, it is automatically created. try { BufferedWriter out = new BufferedWriter( new FileWriter("outfilename")); out.write("aString"); out.close(); } catch (IOException e) { }