'Updated intellij messed up Kotlin with 'Check your module classpath for missing or conflicting dependencies'

Lot's of frustration here. I decided to follow the pop-up prompting an intellij upgrade so it'd stop nagging me.

And now I get a compiler error on certain parts of the code:

Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies

I can make a new kotlin project with only the following and run it:

fun main() {
    println("helloWorld")
}

But if I change it to the following it does not compile:

fun main() {
    println("hello" to "World")
}

modules

enter image description here

$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

I'm on windows. I find it very challenging to debug these kind of things. It feels very similar to this and this upvoted one



Solution 1:[1]

It was solved by downloading a jdk and applying it to the project:

Click the plus, select a vendor and download:

download jdk

And then apply it to the project:

enter image description here

And rebuild.

Solution 2:[2]

I encountered some similar problem on IntelliJ and end up with clicking reload all maven projects button.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adam
Solution 2 y?lmaz