String path = "/path/to/file"; String content = new Scanner(new File(path)).useDelimiter("\\Z").next();