I set environment variable CONFIG. Is it possible to use it to open file?
String path = "$CONFIG/app/users.json"
File file = new File(path);
PS
I cannot add whole path to file to the property file. It is required to use $CONFIG variable.
You could use System class's getenv method like:
String path = System.getenv("CONFIG") + "/app/users.json"
So you could get whatever path you set in CONFIG variable and then you could append further path to it.
There a built-in method, System.getenv() which returns a Map with all the environment variables, from which you can get the one you need:
Map<String, String> env = System.getenv();
String config = env.get("CONFIG");
//and then
String path = config + "/app/users.json";