Here you can find the source of writeFile(String fileName, String message)
public static void writeFile(String fileName, String message)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void writeFile(String fileName, String message) { try {/*ww w. j ava 2 s. c o m*/ File file = new File(fileName); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(message); bw.close(); System.out.println("Done"); } catch (IOException e) { e.printStackTrace(); } } }