IntelliJ - java: Cannot find JDK '1.8'

I suddenly started seeing this issue when upgrading my Java SDK from 1.8 to 10.

I went to File > Project Structure > SDKs, JDK home path was in red so I clicked the folder icon to the right of the path.

Even though the Finder window that popped up already had me in the correct directory /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home (maybe it dropped me wherever my newly updated classpath said Java was?), the path that was displayed in red wasn't the same as that path. Instead, it was using the old one, something like /Library/Java/JavaVirtualMachines/jdk-1.8_(???)/Contents/Home. Clicked OK and the JDK home path was updated to the correct directory, clicked Apply/OK and everything was fine after that.

For reference,

IntelliJ IDEA 2018.2.1 (Community Edition) Build #IC-182.3911.36, built on August 6, 2018 JRE: 1.8.0_152-release-1248-b8 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.12.6


Updating from IntelliJ version 14.0.3 to 14.1 seemed to fix the problem.


Go to:

File => Project structure

And check: Project, Modules and SDKs tabs:

enter image description here

If at SDKs Java 1.8 Sdk isn't selected just add it.

And press OK.