Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.nio.charset.Charset;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- import java.util.ArrayList;
- import java.util.List;
- public class Main {
- public static void main(String[] args) {
- Path path = Paths.get("/etc/rc.local");
- Charset charset = Charset.forName("UTF-8");
- List<String> lines = new ArrayList<>();
- try {
- lines = Files.readAllLines(path, charset);
- } catch (IOException e) {
- System.out.println(e.getMessage());
- }
- for(String line : lines){
- System.out.println(line);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment