Here you can find the source of writeStringToFile(String fileName, String content)
public static void writeStringToFile(String fileName, String content)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void writeStringToFile(String fileName, String content) { FileWriter fileWriter = null; try {//from www .j a v a 2 s .c om File newTextFile = new File(fileName); fileWriter = new FileWriter(newTextFile); fileWriter.write(content); fileWriter.close(); } catch (IOException ex) { throw new RuntimeException(ex); } finally { try { fileWriter.close(); } catch (IOException ex) { throw new RuntimeException(ex); } } } }