1

I recently installed Intellj Idea Community Edition for learning Kotlin: since I'm a Beginner I write some basic code which is as follows:

 fun main() {
        val x = readln().toString();
    
        println(x);
    }

I don't know if there are some spelling mistakes, and yeah I hit the run button to let the build process start during the compilation, the build output showed this message:

Kotlin: Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.String'. Check your module classpath for missing or conflicting dependencies[enter image description here]

This is my project Structure modules snapshot:

enter image description here

and this is my project libraries: enter image description here and my project setting : enter image description here

I'm expecting to get this problem solved thanks in advance

3
  • Try following this tutorial to create a new Kotlin project in IDEA: jetbrains.com/help/idea/get-started-with-kotlin.html. In the 'New Project' wizard, make sure to check the box next to "Add sample code" to have a file with a sample 'Hello World' application created for you.
    – Koyasha
    Commented Jan 16 at 9:21
  • Which version of IDEA is this?
    – nitind
    Commented Jan 16 at 14:48
  • IntelliJ IDEA 2023.3.2 (Community Edition) Build #IC-233.13135.103, built on December 20, 2023 Runtime version: 17.0.9+7-b1087.9 amd64 Windows 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 4 Commented Jan 16 at 14:54

1 Answer 1

1

ok, I think you have set java development Kit for you project so that the IDE can access all of the classes and tools that are needed to run your project correctly.

simply walk through these steps: File > Project Structure > Project Setting > Project > SDK > Edit button > here you have to locate your JDK main folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.