Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void writeTextFile(File file, String text) { try { BufferedWriter bw = new BufferedWriter(new FileWriter(file)); bw.write(text); bw.flush(); bw.close(); } catch (IOException e) { e.printStackTrace(); } } }