public String readFile(String filePath) {
String result = "";
try {
result = Files.readString(Paths.get(filePath));
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
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;
}
}