How does one Export a Kotlin command line app as a jar file?

Hi there!

I’m brand new to Kotlin, and I’d like some help exporting a very simple application I’ve made with Kotlin, so inside my src folder, I have the follwoing:


Above, I have a main.kt file which has my main function, which uses the Point class to do some of its work. There are no imports, so this is the code for main.kt and Point respectively:


How can I produce a .jar file, that I can execute from the command line with java app.jar ? My attempts have been simple, I simple tried to create a new jar artifact:


Although I realize that this is to be expect, what can I do to produce a jar file? Any help regarding this would be much appreciated.

Specify the name of the main class as

Thank you so much Andrey, is there a good tutorial on how to work with jars and artefacts in the Kotlin documentation, if there is, could you please direct me to it?

There's little specific to Kotlin there. A generic IntelliJ-related tutorial will work for you.