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
Post a Comment