java - How to Load File Outside of, but Relative to, the JAR? -


i need load file outside of jar, relative (lib/config/config.ini exact). used exact path, , works fine long working directory jar is, i.e.

/path/to/jar$ java -jar jar.jar 

if it's run this:

~$ java -jar /path/to/jar/jar.jar 

it can't find it. how can correctly load file relative location of jar?

try using getclassloader().getresource("classname") find url of class in jar file. you'll find it's delimited ! between path jar, , path within jar, can slice.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -