Boolean.getBoolean("myvariable"); // where myvariable has been defined in the // Environment variable as Variable name: // myvariable // and Variable Value:true
The above call gives me an output like false. If i use
false
System.getenv("myvariable") ;
then he gives me a conclusion like true.
true
I wonder why it Boolean.getBoolean("myvariable")doesn't work.
Boolean.getBoolean("myvariable")
System.getenvreturns an environment variable. This is not the same as System.getPropertythat returned by the Java system property.
System.getenv
System.getProperty
Boolean.getBoolean uses the last call as described:
Boolean.getBoolean
Returns true if and only if the system property specified in the argument exists and is equal to the string "true". [...] A system property is available through getProperty, a method defined by the System class.
getProperty
Boolean.getBoolean("myvariable"); , myvariable, System.getenv("myvariable"); . , .
Boolean.getBoolean("myvariable");
System.getenv("myvariable");