Here you can find the source of writeFile(String path, Vector
public static void writeFile(String path, Vector<String> contents)
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.Vector; public class Main { /**//from w w w. j a v a2 s .co m * Write a Vector of lines to a file. */ public static void writeFile(String path, Vector<String> contents) { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(path)); for (String line : contents) writer.write(line + '\n'); } catch (Exception ex) { System.err.println(ex); } finally { try { if (writer != null) writer.close(); } catch (IOException ex) { } } } }