Idea overrides java version for terminal

Answered

Windows 10.

JAVA_HOME environment is set to 1.8_221

Project SDK is set to java version 1.8

Open terminal in Idea 2019.1 and check java version: it will be similar to JAVA_HOME and version of Java used in project

Open terminal in Idea 2019.2 and check java version: terminal will use bundled java version instead of JAVA_HOME and version of Java used in project

Probably you can provide workaround to disable this behavior?
It is critical for us to use the same java version in terminal as it set for project

1
6 comments

Have you tried to change Environment variables under **Preferences | Tools | Terminal**?

1

I'm also having this issue. It's a bit frustrating for me that java 8 can't run in this built-in terminal.

I tried to change the settings you suggested but those environment variables are immutable.

0

Here is a related issue on YouTrack:

https://youtrack.jetbrains.com/issue/IDEA-218032

As it can be seen here, the issue will be fixed in IntelliJ IDEA 2019.2.1

0

I swear I am seeing this behavior in IntelliJ 2021.2.2 Ultimate (from 9/14/2021). From Bash terminal window inside IntelliJ:

> echo $JAVA_HOME
C:\Program Files\Java\jdk-11.0.11

External bash window:

> echo $JAVA_HOME
C:\Program Files\Java\jdk1.8.0_281

0

Settings (Preferences on macOS) | Tools | Terminal | Project Settings | Environment variables. Check you don't override it there.

1

It was empty. I removed SDK 11 from my project, although it was set to Java 8. I re-started IntelliJ. Now it seems to be behaving (terminal has $JAVA_HOME as jdk1.8.0_281). I checked another project and it also seems to be OK. Thanks for the clue. 

0

Please sign in to leave a comment.