Java tutorial
import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path copy_from_4 = Paths.get("C:/tutorial/Java/JavaFX", "tutor.txt"); Path copy_to_4 = Paths.get("C:/tutorial/Java/Swing", "tutor.txt"); try (OutputStream os = new FileOutputStream(copy_to_4.toFile())) { Files.copy(copy_from_4, os); } catch (IOException e) { System.err.println(e); } } }