Skip to content

Instantly share code, notes, and snippets.

@jijeshvu07
jijeshvu07 / gist:0600e4e487741a1401b5e049cc2af6e1
Last active July 30, 2018 11:34
Read .properties from a jar
private InputStream readProperties() throws IOException {
File jarPath = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath());
JarFile jarFile = new JarFile(jarPath);
JarEntry entry = jarFile.getJarEntry("PROPERTY_NAME");
InputStream input = jarFile.getInputStream(entry);
return input;
}