I have a service where i am running a jar file by passing properties file
java -jar myjar server config.yml
In order to stop passing config.yml
every time through command line I have configured below code in my main method :
String configFile = args.length > 0
? args[0]
: ClassLoader.getSystemClassLoader().getResource("config.yml").toString();
new myApplication.run("server", configFile);
When I run my application with
java -jar myjar
I am getting the below exception. Please help me understand what's the cause.
Exception in thread "main" java.io.FileNotFoundException: File jar:file:/Users/abc/proj/target/analytics-1.0-SNAPSHOT.jar!/config.yml not found at io.dropwizard.configuration.FileConfigurationSourceProvider.open(FileConfigurationSourceProvider.java:14)