I want to make a jar of a couple of.kt files which contains code that are functions. I don't have classes. My directory looks like this.
src
|--- myPackage
| |--- fileone.kt
| |--- filetwo.kt
|--- myMainFile.kt
myMainFile.kt calls functions from myPackage. I'm interested in generating a jar using the command line.
I used kotlinc myMainFile.kt myPackage -include-runtime -d myRunnable.jar
and it did generate myRunnable.jar
however it didn't work when I tried to run it. I get the following error message: no main manifest attribute, in myRunnable.jar
Kotlin will generate class for you. It will be named MyMainFileKt.
So, to make jar runnable, you will need to provide META-INF/MANIFEST.MF file with the following content:
Manifest-Version: 1.0
Main-Class: MyMainFileKt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.