Terminal inside IntelliJ is not picking up latest JAVA_HOME variable value after Java update.

已回答

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

评论操作 固定链接

Try to logout and login again.

0
评论操作 固定链接

Hello Serge,

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?

 

Best regards,

Anatoly

 

0
评论操作 固定链接

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.

0
评论操作 固定链接

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? 

 

0
评论操作 固定链接

> Does it mean to try to sign out your os user account? 

Yes. It is needed to reload environment variables. 

 

1
评论操作 固定链接

In my case on Ubuntu it didn't help. Finally, I set the variable from the terminal inside IntelliJ and it worked.

0
评论操作 固定链接

Prussaq How did you set it in Ubuntu so that IDE didn't pick it up?

0
评论操作 固定链接

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!

0
评论操作 固定链接

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.

1
评论操作 固定链接

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.

0
评论操作 固定链接

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.

0
评论操作 固定链接

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.

0
评论操作 固定链接

What's the value of JAVA_HOME?

0
评论操作 固定链接

I have fixed it, it was issue with my variable for java 8.

0

请先登录再写评论。