From the course: Build Spring Boot Apps with the Kotlin Programming Language

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Importing a Kotlin JAR file into a Java project

Importing a Kotlin JAR file into a Java project

- [Instructor] Okay, well I think that's enough on calling Kotlin code with Java. I should perhaps say, just before I finish this chapter, you cannot call top level functions that you have written in Kotlin in Java. There's no way for Java coders to be able to access those. But other than that, there's a few little design choices that you need to be thinking about as a Kotlin developer. Things like the Throws annotation and JvmStatic annotation but other than that it's really relatively straightforward to call Kotlin code from Java. I'll finish the chapter, I did promise that we would compile our Kotlin code into a JAR file and then see that we can import that into a Java project. So what I think we'll do here just to show this is I'm going to delete this Main class out of the project, so that we've got a project just with some Kotlin code in and I'd like to now create a JAR file from this project. So I can do that by clicking on the File method and then choosing Project Structure. We…

Contents