how to add jni .so file to jvm module? where and...
# multiplatform
c
how to add jni .so file to jvm module? where android can be added like this :
Copy code
android {
        // ... other configurations ...

        sourceSets {
            getByName("main") {
                jniLibs.srcDirs("src/main/jniLibs")
            }
        }
    }
c
That’s not how it works on a JVM. You have to add the path to the lib when starting the JVM. https://www.baeldung.com/jni > We can now run our program from the command line. > However, we need to add the full path to the directory containing the library we’ve just generated. This way Java will know where to look for our native libs:
java -cp . -Djava.library.path=/NATIVE_SHARED_LIB_FOLDER com.baeldung.jni.HelloWorldJNI
c
It is a multiplatform android project. I can't execute java command.
I need config it inside my kts file.
Copy code
import org.gradle.internal.declarativedsl.parsing.main

plugins {
    id("java-library")
    kotlin("plugin.serialization")
    id("com.google.devtools.ksp")
    alias(libs.plugins.jetbrains.kotlin.jvm)
}
java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
    compilerOptions {
        jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
    }
}

dependencies {
    implementation(libs.bcpkix.jdk15on)
    implementation(libs.ktor.ktor.utils)
    implementation(libs.kotlinx.serialization.json)

    implementation(libs.ktor.client.core)
    implementation(libs.ktor.client.cio)
    implementation(libs.ktor.server.netty)
    implementation(libs.ktor.server.core)
    implementation(libs.kmp.setting)

    implementation(libs.androidx.room.runtime)
//    implementation(libs.androidx.room.ktx)

    // If this project uses any Kotlin source, use Kotlin Symbol Processing (KSP)
    // See Add the KSP plugin to your project
    ksp(libs.androidx.room.compiler)

    testImplementation(libs.kotlin.test)
}
should be configed with this code.
🙄 1
I moved library back to android not jvm to solve this problem.