1
2public class Env {
3 public static void main (String[] args) {
4 for (String env: args) {
5 String value = System.getenv(env);
6 if (value != null) {
7 System.out.format("%s=%s%n",
8 env, value);
9 } else {
10 System.out.format("%s is"
11 + " not assigned.%n", env);
12 }
13 }
14 }
15}
16
17
1String environmentVariable = System.getEnv("environment_variable_name");
2//You can create environment variables on your computer manually
3//and then you must put the environment variable in the parantheses as a String