I keep getting `Caused by: java.lang.NoClassDefFou...
# compose-desktop
m
I keep getting
Caused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
when using the
run
task, is there any way to make it depend on the shadowJar task instead? EDIT: Got it to depend on shadowJar, but for some reason kotlin isn't in any of the configurations?
d
as I learned I'd rather like to suggest an alternative: call gradle task
installDist
of the application plugin like so:
gradle installDist
That way you get a
build/install/<appname>
Folder which contains all gathered libs as well as start scripts for linux/mac and windows, which you just can "kick off". In my case project=appname="kotlinscratch"
Copy code
./kotlinscratch/build
├── bin
│  ├── kotlinscratch
│  └── kotlinscratch.bat
└── lib
   ├── annotations-23.0.0.jar
   ├── clikt-jvm-3.5.2.jar
   ├── kotlin-reflect-1.8.21.jar
   ├── kotlin-stdlib-1.8.21.jar
   ├── kotlin-stdlib-common-1.8.21.jar
   ├── kotlin-stdlib-jdk7-1.8.21.jar
   ├── kotlin-stdlib-jdk8-1.8.21.jar
   ├── kotlinscratch-1.0-SNAPSHOT.jar
   ├── kotlinx-coroutines-core-jvm-1.7.1.jar
   └── okio-jvm-3.3.0.jar
probably you can also just "redefine" the run task to call task "installDist" and then just execute the
project.buildDir/install/<appname>/bin/<appname>
script
Copy code
val r by tasks.creating {
    val installDist by tasks.existing
    dependsOn(installDist)
    doLast {
        val stdout = ByteArrayOutputStream()
        //val stderr = ByteArrayOutputStream()
        val res = exec {
            executable("${project.buildDir}/install/${project.name}/bin/${project.name}")
            //commandLine("optArg1", "optArg2")
            standardOutput = stdout
            errorOutput = stdout // stderr
        }
        println(stdout.toString())
        //println(stderr.toString())
    }
}
and call
gradle r
to run it.
150 Views