Last active
July 30, 2018 11:34
-
-
Save jijeshvu07/0600e4e487741a1401b5e049cc2af6e1 to your computer and use it in GitHub Desktop.
Read .properties from a jar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment