Windows 10, Java 17. I have set a run configuration on Intellij to JAR Application. Once i add, remove or modify an environment variable, the app does not reckognize it.
I have tried:
- Restarting Intellij
- Echoing the environment variable values on cmd
Thhe only thing that seems to work is a PC restart.
Windows 10, Java 17. I have set a run configuration on Intellij to JAR Application. Once i add, remove or modify an environment variable, the app does not reckognize it.
I have tried:
- Restarting Intellij
- Echoing the environment variable values on cmd
Thhe only thing that seems to work is a PC restart.
Share Improve this question edited Mar 15 at 15:26 Robert 43k18 gold badges109 silver badges172 bronze badges asked Mar 14 at 17:21 TSSKTSSK 2291 gold badge6 silver badges19 bronze badges 1- @Robert Windows 10, with UI. – TSSK Commented Mar 15 at 14:57
1 Answer
Reset to default 1Each process on Windows holds it's own copy of all environment variables. It gets them on start by copying the environment variables of the parent process (the one that has started the process, e.g. Windows Explorer for programs started via start-menu or shortcut on desktop).
If you use the Windows dialog to modify the environment variables this will not change anything to the running processes. When you save the modified environment variables Windows sends a message to all running processes that the environment variables have changed. Those processes that listen for this message will then request the changes and update their environment variables accordingly.
Besides the processes that belong to Windows most processes just ignore this message. This becomes important if you use third party launcher like Open-Shell menu which do not update their environment variables. If you use it to start e.g. a new IntelliJ instance the old environment variables will be used.
Conclusion: The main question is how you start IntelliJ. After changing environment variables make sure to only start it using programs that have updated their environment variables. Or make sure to restart those programs as well.