Scene:
Eclipse has been launched under Ubuntu, and the environment variable (export $ENV =123) has been set through the terminal and then displayed as empty when obtained through SYSTEM.GETENV ().
Explain:
Environment variables are only under the process tree and only when the process is started. Eclipse is a child of your shell-so when you start eclipse, it inherits all of the environment variables defined on your shell.
You might have defined environment variables on the shell after you started eclipse, so Eclipse and the Java child processes it created are not aware of your new environment variables.
Because of this behavior, the solution here is actually to exit Eclipse and restart it from the shell, which is defined before the environment variable. Another option is to go to the project's run configuration and define the environment variables in it.
Reference:
Https://stackoverflow.com/questions/29782467/system-getenv-returns-null-when-the-environment-variable-exists
Why does Java use SYSTEM.GETENV () to get the environment variable you just set is empty