How to convert a Kotlin source file to a Java source file

I have a Kotlin source file, but I want to translate it to Java.

How can I convert Kotlin to Java source?

8 s
8

As @Vadzim said, in IntelliJ or Android Studio, you just have to do the following to get java code from kotlin:

  1. Menu > Tools > Kotlin > Show Kotlin Bytecode
  2. Click on the Decompile button
  3. Copy the java code

Update:

With a recent version (1.2+) of the Kotlin plugin you also can directly do Menu > Tools > Kotlin -> Decompile Kotlin to Java.

Leave a Comment