Skip to content

Instantly share code, notes, and snippets.

@LetItRock
Last active August 29, 2015 14:18
Show Gist options
  • Save LetItRock/088d5203c535e6466792 to your computer and use it in GitHub Desktop.
Save LetItRock/088d5203c535e6466792 to your computer and use it in GitHub Desktop.
Read file from classpath
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("META-INF\\teamdev.licenses")));
System.out.println("------------------------------------");
System.out.println("Text from file: ");
String string = null;
while ((string = reader.readLine()) != null) {
System.out.println(string);
}
System.out.println("------------------------------------");
} catch (Exception e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment