Is there possibility to run Kotlin code in CLI wit...
# announcements
j
Is there possibility to run Kotlin code in CLI with main inside the class (in companion object or object)? I know, main it would run with main outside the class 😄 As far as I understand that second answer to that question https://discuss.kotlinlang.org/t/is-the-main-function-must-be-a-standalone-function/877 it should work
Compiling like this
kotlinc -include-runtime asdf.jar asdf.kt
And then running
java -jar asdf.jar
Gives "no main attribute..."
p
Try to specify the name of the class where
main
method is located. https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html
j
Trying to compile with (
test
is a package)
jar cfe asdf.jar test.asdf test/asdf.class
jar cfe asdf.jar test.asdf test/asdfKt.class
jar cfe asdf.jar test.asdfKt test/asdfKt.class
But none of those is working