Here you can find the source of writeStringToFile(File file, String data)
public static void writeStringToFile(File file, String data)
//package com.java2s; import java.io.File; import java.io.FileWriter; public class Main { public static void writeStringToFile(File file, String data) { FileWriter writer = null; try {/*from w w w .j a v a 2s . c o m*/ if (file.exists()) file.delete(); file.createNewFile(); writer = new FileWriter(file); writer.write(data); writer.close(); } catch (Exception e) { } } }