Java tutorial
//package com.java2s; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { /** * Write a string value to the specified file. * @param filename The filename * @param value The value */ public static void writeValue(String filename, String value) { try { FileOutputStream fos = new FileOutputStream(new File(filename)); fos.write(value.getBytes()); fos.flush(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }