https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

Carter

05/29/2020, 6:58 PM
How do I run a kotlin multiplatform module from the command line on the JVM? My module “app” applies both multiplatform and application plugins.  I’m imagining something like:
./gradlew :app:run --args="..."
 but when I do that I get 
Error: Could not find or load main class
 .  I have a main class set in 
app/build.gradle
 but it looks like I’m missing something. I found one thread from about a year ago, but it doesn’t seem to have really made it clear what’s the right solution.
r

russhwolf

05/29/2020, 7:12 PM
You might need to add
withJava()
to your jvm target block to make the application plugin see it. https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#java-support-in-jvm-targets
🎉 1
c

Carter

05/29/2020, 7:16 PM
That solved it. Thank you! This type of thing is really difficult to Google for 😅.
👍 1
3 Views