I have jar file that I want to run along with specific properties file. I am running following command to execute that jar
java –jar –DApp.config.file=local.properties App.jar
With this command I am getting following error
Could not load properties from class path resource [local.properties]: class path resource [local.properties] cannot be opened because it does not exist
Based on what I read so far if you are passing -jar then you don't have to worry about $CLASSPATH. Am I missing something here ?
PS - local.properties and jar files are in same directory.
The -jar
option specifies the jar file to launch, hence, has to remain right before the naming of the intended jar file:
java –DApp.config.file=local.properties –jar App.jar
Don’t place other options between –jar
and App.jar
You can use the following snipped to access external properties file and run your jar file:
java -jar jarname.jar --spring.config.location=/path/to/propertyfile.properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With