Home > Back-end >  Why my java version in terminal is different from the jdk version showed in idea?
Why my java version in terminal is different from the jdk version showed in idea?

Time:11-13

My java version in terminal is different from the version in IntelliJ.

When I typed 'java -version' in the terminal, the version is 13.0.2, but when I set the SDK in the IntelliJ IDEA, the version is 11.0.4. I typed ' usr/libexec/java_home' in the terminal, but get the result 'zsh: no such file or directory: usr/libexec/java_home'. How should I fix it?

CodePudding user response:

Go to File -> Project Structure -> Project and set SDK to correct version. You can find path to it by executing

echo $JAVA_HOME

in your terminal.

CodePudding user response:

The command

$ java -version

will use the first java executable from your enter image description here

I typed ' usr/libexec/java_home' in the terminal, but get the result 'zsh: no such file or directory: usr/libexec/java_home'. How should I fix it?

Try this one instead:

/usr/libexec/java_home

CodePudding user response:

This is happened due to multiple jdk version existence in a local machine. To tackle this, need to set up the environment variable for our ease. There are couple of ways to switch it. This link will give you an understanding. Also do the same approach for your OS. https://www.geeksforgeeks.org/how-to-install-multiple-jdks-in-windows/. Always need to address the foundations rather than making instant solutions.

  • Related