Java tutorial
//package com.java2s; import java.io.*; public class Main { public static void WriteFile(String file, String message) throws IOException { File f = new File(file); if (!f.exists()) { f.createNewFile(); } FileOutputStream fout = new FileOutputStream(file); byte[] bytes = message.getBytes(); fout.write(bytes); fout.close(); } }