I'm creating this question only because the duplicate questions I found were marked with Windows and Ubuntu respectively, whereas I am experiencing this issue on macOS
I have IntelliJ Ultimate 2017.2 installed, with JDK 8 added, and want to add JDK 10. After downloading and installing Oracle's JDK 10, and attempting to add /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
as a new JDK to IntelliJ, I got the error message
The selected directory is not a valid home for JDK
despite the fact that the path and file permissions of this JDK 10 directory were seemingly all aligned with the JDK 8 ones.