I've got simple script
package com.lapots.game.journey.ims.example fun main(args: Array<String>) { println("Hello, world!") }
And here is gradle
task
task runExample(type: JavaExec) { main ='com.lapots.game.journey.ims.example.Example' classpath = sourceSets.main.runtimeClasspath }
But when I try to run task gradle runExample
I get error
Error: Could not find or load main class com.lapots.game.journey.ims.example.Example
What is the proper way to run application?
Gradle is a build system that is very commonly used in the Java, Android, and other ecosystems. It is the default choice for Kotlin/Native and Multiplatform when it comes to build systems.
Thanks to the link how to run compiled class file in Kotlin? provided by @JaysonMinard that main
@file:JvmName("Example") package com.lapots.game.journey.ims.example fun main(args: Array<String>) { print("executable!") }
and that task
task runExample(type: JavaExec) { main = 'com.lapots.game.journey.ims.example.Example' classpath = sourceSets.main.runtimeClasspath }
did the trick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With