Terminal inside IntelliJ is not picking up latest JAVA_HOME variable value after Java update. Follow
After automatic Java Update of my windows system, I changed my JAVA_HOME and PATH environement variables to point to valid Java installation but the same is not reflected in the terminal inside intellij which is pointing to cmd.exe.
The issue doesn't disappear after restart.
Please sign in to leave a comment.
Try to logout and login again.
I would like to switch between java versions (OSX) back and forth. I expect that it shall be enough to set the jdk version in "Project Settings" -> "Project SDK". This approach does not work in Ultimate 2020.2. Both JAVA_HOME env var and java version in IntelliJ console are unaffected by what is set in "Project Settings".
What is the correct approach?
Project JDK doesn't affect Terminal tool window environment. The only way to change it is via your system environment settings: https://stackoverflow.com/a/26586170/104891.
I'm facing the same under IntelliJ IDEA 2020.3 (Ultimate Edition).
What does it mean "Try to logout and login again" ?
Does it mean to try to sign out your os user account?
> Does it mean to try to sign out your os user account?
Yes. It is needed to reload environment variables.
In my case on Ubuntu it didn't help. Finally, I set the variable from the terminal inside IntelliJ and it worked.
Prussaq How did you set it in Ubuntu so that IDE didn't pick it up?
Serge Baranov Sorry, I did it wrong, not in /etc/profile. So after logout/login it didn't work. I think the thread can be deleted. Thank you!
Having similar issue. I am on Windows. I have X projects open and switch JAVA_HOME version: PC -> Advanced system settings -> Environment Variables.
Few weeks ago it worked as expected. I close terminal inside project and when I open it again: java -version, showed correct version. Recently it doesn't work that way anymore. It seems like it is unable to close active terminal session.
Jevgeni Serkin Environment is inherited from the parent process. When you change the environment variable, you need to reboot or logout/login for all the processes to update it.
I am having the same issue. Switching to java 17 works fine but when I switch to java 8 I get the message that it is not defined correctly. Tried logout/login and it didn't work.
Semko Developer what exact error do you get? Please provide the screenshots showing the error text and the value of JAVA_HOME environment variable printed in the terminal.
This is what I get
What's the value of JAVA_HOME?
I have fixed it, it was issue with my variable for java 8.