Here you can find the source of writeFile(final String content, final String path)
public static void writeFile(final String content, final String path)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.PrintWriter; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; public class Main { public static void writeFile(final String content, final String path) { try {/*from w w w. ja va 2s.c o m*/ final PrintWriter writer = new PrintWriter(path); writer.print(""); writer.close(); Files.write(Paths.get(path), content.getBytes(), StandardOpenOption.CREATE); } catch (final IOException e) { e.printStackTrace(); } } }