InputStream stream = YourClass.class.getResourceAsStream("/" + pathToYourFile);
Example:
You have a file insertSomething.sql in your jar.
public static String getResourceContent(
final String path) throws IOException {
InputStream stream = YourClass.class.getResourceAsStream("/" + path);
if (stream != null) {
return IOUtils.toString(stream);
}
}
Now you can get the content:
String content = getResourceContent("insertSomething.sql");