Loading a text file resource from classpath in Java

/ Published in: Java
Save to your folder(s)

Copy this code and paste it in your HTML
  1. final URL resource = this.getClass().getClassLoader().getResource(path);
  2. List<String> lines=IOUtils.readLines((InputStream) resource.getContent());

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.