I am currently going crazy trying to start my Dropwizard application that I have packed into a JAR file. When I try to run the JAR with java -jar myjar.jar server configs.yml
I get this error:
java.io.FileNotFoundException: File configs.yml not found.
The configs.yml file in the base of my project so the path should be no problem. I've tried different ways to set the path like absolute and relative but nothing works.
I've also changed my Application file trying to add things like:
public void initialize(Bootstrap<AppConfig> bootstrap) {
bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)));
}
bootstrap.setConfigurationSourceProvider(
new ResourceConfigurationSourceProvider());
public void initialize(Bootstrap<AppConfig> bootstrap) {
}
I have looked at all possible tutorials including Dropwizards own and I followed it to a T even copying their code, but still I get the same error. I've followed other tutorials. I've searched for the problem and tried all tricks but nothing seems to work.
I just want my JAR to start. How do I package my config.yml file with my JAR so I can access it through my command? Is there something wrong with Intellij, Dropwizard, Maven or me?