Here you can find the source of writeToFile(String content, String filePath)
public static void writeToFile(String content, String filePath)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.UnsupportedEncodingException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void writeToFile(String content, String filePath) { Path path = Paths.get(filePath); try {/*from w w w .j a v a 2s . co m*/ Files.write(path, content.getBytes("utf-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }