Thread
#multiplatform
    c

    Carter

    2 years ago
    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.
    russhwolf

    russhwolf

    2 years ago
    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
    c

    Carter

    2 years ago
    That solved it. Thank you! This type of thing is really difficult to Google for 😅.