You can access environment variables using the brace-enclosed environment
variable syntax. Example:
VM options: -Dfoo=${MY_ENV_VAR}
https://stackoverflow.com/questions/21558855/using-environment-variables-in-vm-options-and-program-arguments
On Thu, 8 Oct 2020, 04:34 Greenberg, Gary,
wrote:
Hi Gary,
System.getEnv() will return O/S environment variables.
E.g. System.out.println("Path: " + System.getenv("PATH")); would print my
current PATH variable.
System.getProperty() is what you are thinking of. E.g. adding -Denv=dev to
my VM options in Netbeans, then calling System.out.println("
I have created a Java application for some data conversion.
It accepts 2 parameters in the command line: input and output file.
Besides that, some program options are defined by the properties file.
I have several of these properties files for different environments, where
name of the environment i