-1

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.

1
  • @Robert Windows 10, with UI. Commented Mar 15 at 14:57

1 Answer 1

1

Each 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.