Compiling Mixed Java and Kotlin Files on the Command Line

You should first invoke kotlinc to compile Kotlin files, then javac to compile Java, passing the result of the first compilation in the classpath. If Kotlin sources reference something from Java, the compiler will load the corresponding Java sources automatically, provided they are located in one of the source directories passed to the command line compiler. Currently it’s not possible to provide paths to individual .java files to be loaded by the Kotlin compiler, or to provide a directory with an intention of only loading .java files from there: each source directory you pass to kotlinc will result in .kt files being compiled and .java files being loaded if needed.

2 Likes