Is it possible to export a JAR file with only Kotlin classes, without any Java class?

2

I'm using Intellij IDEA to develop a project in Kotlin, and I've reached a point where I need to create an executable file to run on the server, but when I try to create a JAR Artifact , , something that does not exist in the project. Do you have any solutions?

    
asked by anonymous 21.11.2017 / 20:49

1 answer

1

You can define a class with the main method that is recognized by Intellij in two ways:

object MainClass {
    @JvmStatic
    fun main(args: Array<String>) {
        println("Sou uma classe com um main definido")
    }
}

Or:

class MainClass 

fun main(args: Array<String>) {
    println("Sou uma classe com um main definido")
}

Both cases are listed as possible main classes for your jar:

    
03.12.2017 / 16:50