Here you can find the source of writeFile(String content, String fileName)
public static void writeFile(String content, String fileName) throws FileNotFoundException
//package com.java2s; //License from project: Open Source License import java.io.FileNotFoundException; import java.io.PrintWriter; public class Main { public static void writeFile(String content, String fileName) throws FileNotFoundException { PrintWriter writer = new PrintWriter(fileName); try {/*from w w w . j a v a2 s . co m*/ writer.print(content); } finally { closeQuietly(writer); } } private static void closeQuietly(PrintWriter writer) { try { writer.close(); } catch (Exception e) { } } }