Kotlin Hello World JAR文件实现

在Kotlin主目录下的src/main/kotlin目录中创建一个名为dev.tony.helloworld的新包。创建一个新文件Main.kt,并在文件顶部添加@file:JvmName("Main")。在Main.kt文件中使用package dev.tony.helloworld声明包名。然后,在Gradle(build.gradle)中添加插件id 'application',并设置mainClassName和jar:mainClassName = 'dev.tony.helloworld.Main' jar { manifest { attributes 'Main-Class': mainClassName } }。生成并运行程序:选择Gradle任务 -> 应用程序 -> 运行(Shift + F10)。构建JAR文件:选择Gradle任务 -> 构建。
zip
kotlin-helloworld-jar-master.zip 预估大小:19个文件
folder
kotlin-helloworld-jar-master 文件夹
file
gradlew 6KB
file
settings.gradle 33B
folder
src 文件夹
folder
main 文件夹
folder
kotlin 文件夹
folder
dev 文件夹
folder
tony 文件夹
folder
helloworld 文件夹
file
Main.kt 144B
folder
.idea 文件夹
file
misc.xml 353B
file
compiler.xml 169B
file
uiDesigner.xml 9KB
file
gradle.xml 579B
folder
codeStyles 文件夹
file
Project.xml 1KB
file
codeStyleConfig.xml 142B
file
.gitignore 47B
file
jarRepositories.xml 839B
file
vcs.xml 180B
folder
gradle 文件夹
folder
wrapper 文件夹
file
gradle-wrapper.properties 200B
file
gradle-wrapper.jar 58KB
file
README.md 1KB
file
gradlew.bat 3KB
file
gradle.properties 26B
file
.gitignore 41B
file
build.gradle 474B
zip 文件大小:64.19KB