Java tutorial
import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; public class Main { public static void main(String[] args) throws Exception { Charset cs = Charset.forName("US-ASCII"); Path source = Paths.get("test1.txt"); List<String> lines = Files.readAllLines(source, cs); for (String line : lines) { System.out.println(line); } } }