简体   繁体   中英

Add files to current classpath of jar file

i have a jar created by a spring batch app , i am using a config.proprerties but i need that this file is located outside from jar. i have the config.properties en the location "var/user/config.properties" and i have run the jar using the command:

java -classpath "/var/user/config.properties" batch-0.0.1-SNAPSHOT.jar es.exp.exp.config.BatchConfiguration someJob date=20210115 systemDate=15

But i thinck that the argument -classpath set all classpath, i mean that classpath argument remove the jar classpath and put only /var/user/config.properties in classpath. and i don't need this, i need the classpath to be "actual jar Classpath + /var/user/config.properties". any idea?

Sorry for my english, is not my native languaje.

Classpath elements in -classpath (or -cp ) are separated by ":" on Linux, or ";" in Windows.

Also, if you want config.properties to be accessible in the classpath you don't need to add the file in the path, but the directory containing the file.

Try with:

java -cp /var/user:batch-0.0.1-SNAPSHOT.jar es.tirea.cicosgw.config.BatchConfiguration someJob date=20210115 systemDate=15

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