Hi all - I’ve used the package task to generate an...
# compose-desktop
x
Hi all - I’ve used the package task to generate an
.app
artefact for macos. But when i open it - it does not open the main window. The window does open through Android Studio runtime configurations, but not when packaged for some reason. I’ve attached the compose desktop build script in the thread, am i missing anything here?
Copy code
compose.desktop {
  application {
    mainClass = "org.sample.ApplicationKt"

    nativeDistributions {
      targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
      packageName = "PSCore-Multiplatform"

      val iconsRoot = project.file("src/jvmMain/resources/icons")

      macOS {
        iconFile.set { iconsRoot.resolve("pscore-multiplatform.icns") }
      }
      
      windows {
        iconFile.set { iconsRoot.resolve("icon-windows.ico") }
        menuGroup = "Compose Examples"
        // see <https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html>
        upgradeUuid = "18159995-d967-4CD2-8885-77BFA97CFA9F"
      }

      linux {
        iconFile.set { iconsRoot.resolve("icon-linux.png") }
      }
    }
  }
}
j
Not enough information for me to tell for sure, but if I had to guess, I would imagine that the program is crashing due to either an unspecified JVM module dependency or underspecified plist file. But it's hard to tell without an error message. Can you try running
./gradlew runDistributable --no-daemon
and see if that triggers a more informative error message?
x
ah you were right. Got this exception thrown when i ran that gradle task
thanks @jim - is there a reason why these sort of exceptions only thrown when packaged?
j
Yeah, so when you run locally in debug mode, you are running with the whole JVM. When you package the app, it only packages the specified modules in order to keep the bundle/download size small for all your users. But if you don't specify which JVM modules you are using, this could mean that a class you need is unavailable since it wasn't bundled. Check out the "Configuring included JDK modules" here: https://github.com/JetBrains/compose-jb/blob/1f15bbb373c84c93245393fd9db22bbc36e91[…]ab/tutorials/Native_distributions_and_local_execution/README.md
x
i see - that makes sense. thanks again 🙂
ran the static analysis tool - it recommended some modules but adding those didnt work. Looked up where
javax.naming
was coming through, and then added
"java.naming"
module, and it worked like a treat 🧁
thanks a lot @jim 🙂