How to compile kotlin script to a jar

760 Views Asked by At

I have a kotlin script file named CheckUtils.kts.

I want to compile the CheckUtils.kts to a jar which can be run with "java -jar CheckUtils.jar". I try to use kotlinc to compile kts file to a jar, but i failed.

 kotlinc src/CheckUtils.kts -include-runtime -d CheckUtils.jar

I got an error when i "java -jar CheckUtils.jar"

.jar has no main manifest attribute

So , how can i compile a kts file to a jar?

1

There are 1 best solutions below

0
On

You can't compile a Kotlin script to an executable fat-jar with kotlinc, but you should be able to make a standalone binary with kscript