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

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -