Does kotlin compile against jdk 8 class files?


#1

I'm thinking of using Kotlin for a javafx 8 program using early access jdk 8. I tried scala but it doesn't compile against jdk8 class files that use lambdas.

How about Kotlin?

Thanks

Curtis


#2

Just tried it and it doesn't seem to work at all.


#3

We never tried to compile against JDK8 class files. What eceptions do you get?


#4

I use Oracle JDK8 by default and IntelliJ IDEA, the Kotlin plugin/compiler, and the resultant code seems to work fine. I haven't tried using the Lambda JDK8 for this as yet. Oracle JDK8 has all the lambda support just not the new library, which exists only in the Lambda JDK8.

Do you have some specific code for people to try out?


#5

Good to know. I must be doing something wrong. I'm coming back to Kotlin after a while and can't even get a "hello world" to work:

Test.kt:

package hello fun main(args: Array<String>) {   println("DOH") }

Error: Could not find or load main class hello.Test

There are no run or debug options in the context menu of the Test.kt file.

Using IntelliJ 129.400 with kotlin 5.2 plugin


#6

OK, got it to work using "hello.HelloPackage" for the main class. Seems to work with jdk 8. Thanks guys.


#7

Nice, also works with the new java.time package in jdk 8 which I couldn't get Scala working with because java.time uses lambdas. I think there's a new JVM bytecode or something for that.