java - how to set custom system variable for JVM to access properties file? -


i need read config.properties file location set variable -dapp.conf=/path/to/config.properties , set datasource when launch application. file should @ location within filesystem. how this?

you can load properties file next:

properties p = new properties(); try (reader reader = new filereader(system.getproperty("app.conf"))) {     p.load(reader); } 

once loaded can use properties instance set datasource configuration.


Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Java JSoup error fetching URL -

webstorm - PhpStorm file cache conflict with TypeScript compiler -