开发者

Configuration of a JAR application

I want to distribute my application like a JAR file and configurable by external files, so the final directory structure will looks like:

--conf
----log4j.properties
    ...
--lib
----log4j.jar
    ...
--myApp.jar
--run.bat

In the run.bat I start my application with:

java -jar myApp.jar

In the MANIFEST.MF I have class-path entry:

Class-Path: conf/log4j.properties lib/log4j.jar

But the application is not able to locate its configuration files (but it is able to locate the libs!). What I am missing? Anyway is it a good practice to externalize configuration files to a folder whi开发者_如何转开发ch are relevant to the 'main' JAR?

EDIT: My intention to externalize the configuration files is that in this way they can be edited more easily. EDIT: config -> conf (typo in the description of the issue)


The classpath should be:

Class-Path: conf/ lib/log4j.jar


Is it because you have your config files in the "conf" directory and your classpath is looking for a "config" directory? :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜