Reputation: 9785
on linux command line:
could it be:
public Properties getEnvironment() throws java.io.IOException { Properties env = new Properties(); env.load(Runtime.getRuntime().exec("env").getInputStream()); return env; } Properties env = getEnvironment(); String myEnvVar = env.get("DB_SYSTEM");
Upvotes: 1
Views: 1530
Reputation: 223043
Just use System.getenv
:
String dbSystem = System.getenv("DB_SYSTEM");
If you call it with no arguments, it returns all the environment variables:
Map<String, String> env = System.getenv();
String dbSystem = env.get("DB_SYSTEM");
Upvotes: 4