[英]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.我有一个由spring 批处理应用程序创建的 jar,我使用的是 config.proprerties,但我需要此文件位于 jar之外。 i have the config.properties en the location "var/user/config.properties" and i have run the jar using the command:
我的 config.properties 位于“var/user/config.properties”位置,并且我使用以下命令运行了 jar:
java -classpath "/var/user/config.properties" batch-0.0.1-SNAPSHOT.jar es.exp.exp.config.BatchConfiguration someJob date=20210115 systemDate=15 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.但我认为参数 -classpath 设置了所有类路径,我的意思是类路径参数删除 jar 类路径并仅将 /var/user/config.properties 放在类路径中。 and i don't need this, i need the classpath to be "actual jar Classpath + /var/user/config.properties".
我不需要这个,我需要类路径是“实际的 jar 类路径 + /var/user/config.properties”。 any idea?
任何想法?
Sorry for my english, is not my native languaje.对不起我的英语,不是我的母语 languaje。
Classpath elements in -classpath
(or -cp
) are separated by ":" on Linux, or ";" -classpath
(或-cp
)中的类路径元素由 Linux 上的“:”或“;”分隔in Windows.在 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.此外,如果您希望
config.properties
在类路径中可访问,则无需在路径中添加文件,而是在包含文件的目录中添加。
Try with:尝试:
java -cp /var/user:batch-0.0.1-SNAPSHOT.jar es.tirea.cicosgw.config.BatchConfiguration someJob date=20210115 systemDate=15
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.