I set an Environment Variable from a .sh file for example
export JBOSS_HOME=/Applications/EAP-6.2.0/jboss-eap-6.2
Now in my Java application if I need to get this JBOSS_HOME I will write
String jbossHome = System.getProperty("JBOSS_HOME");
This works fine when I run the code on the windows machine. It does not give the value for JBOSS_HOME on Mac machine. How can I retrive JBOSS_HOME value on Mac OS machine?
Environments are retrieved via:
System.getenv(name);
Not with System.getProperty().
Use System.getenv() without paramters to get the map of all environment variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With