I have build a jar file of classes and configuration files. The configuration.yml file is located in root of the jar. When I try to run the application using the following command:
java -jar target/drop-wizard-0.0.1-SNAPSHOT.jar server configuration.yml
Exception in thread "main" java.io.FileNotFoundException: File configuration.yml not found <br>
configuration.yml is expected to be in the working directory i.e. on the filesystem, because this is how you try to read it. If you want to read it from jar file or from classpath in general you need to use getResource or getResourceAstream methods. (please see this similar question and answer)
If you want to read the config from a resource inside your jar then you might want to configure your application to use UrlConfigurationSourceProvider instead of FileConfigurationSourceProvider and pass it the URL which you can obtain from getResource, the open method of the underlying interface expects a
String as parameter, so you will need to use URL#toString on the result of getResource.