public static String loadFileAsString(String path) {
InputStream stream = YourClassName.class.getResourceAsStream(path);
try {
String result = new String(stream.readAllBytes());
return result;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}