Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; public class Main { public static void writeToFile(File file, String content) { try { PrintWriter out = new PrintWriter(file); out.println(content); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }