简体   繁体   中英

Specify a parameter for using files inside a Jar

Say log.properties is in the test.jar . I would like to specify the file parameter using some file inside the jar, is this doable?

-DLog=target/classes/log.properties

Though question is not that clear to me, I will try to answer:

If you have are loading your parameter'd file with:

getClass().getClassLoader().getResourceAsStream(fileParameter);

then even if your file is inside jar (in classpath) it should work. And you should be able to pass parameter something as -DLog=log.properties , so that it will search all the possible paths in classpath.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM