Reputation: 1215
My Project is set to run with Java 11.
I can build it without any issues, but when I try to run it, it is looking for Java 1.8
Running on Mac OS 12.2.1 IntelliJ Version 2021.3.2
Upvotes: 6
Views: 19157
Reputation: 21
I had the similar issue, so sometimes even we change the java version in project structure it still remains unchanged.
So in IntelliJ terminal execute java -version
command and see the version is the expected one, if not, you might need to restart the IDE.
Upvotes: 0
Reputation: 54
An update for 2023 version of Intelij:
There are 2 different solutions based on the issue at hand:
Upvotes: 2
Reputation: 1215
The problem was in the run configuration. I needed to specify the java version as well. Thanks for the suggestions
Upvotes: 7
Reputation: 4654
You have to check the following settings match (for Java 17):
Also if you use maven check that the correct version is set and if not, change them and reimport the project.
Upvotes: 7