I have a JAR file that contains an application as well as configuration files for that application. The application loads configuration files from the classpath (using
When you use the -jar option to launch your application:
... the JAR file is the source of all user classes, and other user class path settings are ignored.
as described here. A workaround would be to specify the classpath in the jar file's manifest to include the additional path (described here).
However, given that you are only talking about amending configuration you may want to take a different approach that is not reliant on the classpath. For example, I typically configure my applications through Spring using property files to determine the location of databases, etc. My Spring configuration is consistent across test, QA and live environments but I pass a different property file as a command line argument when launching the app.
Spring Configuration Snippet
Property File Snippet
dbServer=MyServer
dbPort=1433
dbName=MyDb
dbUserName=Me
dbPassword=foobar