1

I'm having a weird error using Kotlin with Eclipse IDE (Oxygen + Kotlin plugin 0.8.6 + Java 10.0.2).

While it's able to compile the code shown here:

package com.test

fun main(args: Array<String>) {
    Thread.currentThread()
    println("hello")
}

It always fails executing inside Eclipse (in fact I think it fails while trying to compile) it with following error:

/<path>/src/com/test/Test1.kt
    ERROR: Unresolved reference: Thread (6, 5)

And, it works properly if the same is done in Intellij IDEA. But I would like keep using Eclipse.

Any thoughts about what could be happening?

JZarzuela
  • 502
  • 4
  • 11
  • 1
    please see https://stackoverflow.com/questions/31712046/kotlin-unresolved-reference-in-intellij – S.K. Aug 19 '18 at 09:04
  • Thanks for the answer, but in my case I'm using Eclipse, not IntelliJ, because the rest of my projects are there and I wanted to start moving parts to kotlin – JZarzuela Sep 02 '18 at 10:21
  • ...But you gave me an idea, so I reviewed the classpath and saw that the project was using classpath (Kotlin) and modulepath (JRE for Java 10)... Doing some tests/changes I stumbled upon the fact that it was the Java 10 JRE what it didn't like... I changed it to Java 8 JRE and now it works (and it moved to a classpath library and doesn't appear as modulepath anymore). – JZarzuela Sep 02 '18 at 10:26

1 Answers1

1

Following S.K. advice I read the suggested post about IntelliJ problem. Even though mine was related to using Eclipse, it gave me a clue to test.

So I reviewed the classpath and saw that the project was using both a classpath (Kotlin) and a modulepath (JRE for Java 10)... Doing some tests/changes I stumbled upon the fact that it was the Java 10 JRE what it didn't like...

I changed project'sJRE to Java 8 JRE and now it works (and it moved to a classpath library and doesn't appear as modulepath anymore).

The Kotlin Eclipse plugin doesn't work with Java 10 yet.

Thanks

JZarzuela
  • 502
  • 4
  • 11