Hey, anyone maybe seen errors like this `Caused by...
# compose-desktop
a
Hey, anyone maybe seen errors like this
Caused by: java.lang.ClassNotFoundException: java.lang.management.ManagementFactory
when running
runDistributable
and maybe know how i can include it? Using temurin-jdk-17 and the gitlive firebase-sdk which seems to use the ManagmentFactory to replace some android dependencies.
runRelease
works fine but something is probably not bundled correctly
Adding
includeAllModules = true
in the nativeDistribution block fixed this for me.
Copy code
compose.desktop {
    application {
        mainClass = "com.example.desktop.MainKt"
        javaHome = System.getenv("JAVA_HOME")

        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            includeAllModules = true  // <--
            packageName = "ExampleDesktop"
            packageVersion = "1.0.0"
        }
    }
}
🙌 1
👍 1
m
includeAllModules = true, worked for me as well, Additionally if you are targeting windows it is a better to add a desktop short-cut
Copy code
compose.desktop {
    application {
        mainClass = "com.example.utils.myapp.MainKt"

        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "MyApp"
            packageVersion = "1.0.0"
            includeAllModules = true
            windows{
                menuGroup = "MyApp"
                shortcut =true
                menu = true
            }
        }
    }
}
u
I might be late, but includeAllModules increases package size so you can include only neccessary modules as I did when I faced this problem like this:
Copy code
nativeDistributions { 
    modules("java.management") // this module contains missing ManagementFactory
}
105 Views