 <p>With Java 7, it's as simple as:</p> <pre><code>final String EoL = System.getProperty("line.separator"); List&lt;String&gt; lines = Files.readAllLines(Paths.get(fileName), Charset.defaultCharset()); StringBuilder sb = new StringBuilder(); for (String line : lines) { sb.append(line).append(EoL); } final String content = sb.toString(); </code></pre> <p>However, it does havea few minor caveats (like handling files that does not fit into the memory).</p> <p>I would suggest taking a look on <a href="http://docs.oracle.com/javase/tutorial/essential/io/charstreams.html">corresponding section</a> in the official Java tutorial (that's also the case if you have a prior Java).</p> <p>As others pointed out, you might find sime 3rd party libraries useful (like Apache commons I/O or Guava).</p>