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:

/uploads/kotlinlang/original/1X/e7e4c5b4ce6b349d3cd7514033de09cd19155c90.png

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:

/uploads/kotlinlang/original/1X/4c48b857ecff9256322fdb951398a7db3e1df01d.png

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:

/uploads/kotlinlang/original/1X/92bc837e51da71ca04e136d409d1c683281067f8.png

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 foo.bar.BarPackage

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.