Can't import java.nio.file.Path

How does IntelliJ decide how to import java.something ?

I’ve removed java 14 from my laptop, and IntelliJ still really seems to want to use it.

I see the following error when I try to rebuild the project in IntelliJ

Error:Cannot run program "/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/bin/java" (in directory "/Users/jimka/Library/Caches/JetBrains/IntelliJIdea2020.1/compile-server"): error=2, No such file or directory

And I see the following in the editor

Screenshot 2020-07-17 at 17.22.00

However, when I run sbt test from the shell, it compiles and runs correctly.
I’m pretty sure that there’s something IntelliJ is caching.

I’ve removed the ~/.ivy2 directory and also the ~/Library/Caches/JetBrains directory,
but it doesn’t help. I’ve also searched for references to jdk, java, and jre using IntelliJ preferences,
and changed all references to java 14 which I can find.

I finally found an xml file in my project .idea/misc.xml which contained references to java 14. I edited that file and changed to java 11. Then immediately intelliJ popped up a warning asking me whether wanted to switch to java 11. I clicked OK, and it seems happy now.

IntelliJ is an adventure.

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="11" project-jdk-type="JavaSDK" />