Me again :wave: :sweat_smile: I'm struggling to pr...
# jewel
p
Me again 👋 😅 I'm struggling to provide the JBR when packaging an app using jewel. I can run
packageDistributionForCurrentOS
with corretto-22, but it obviously complains about not having the JBR when I try to run the app.
Copy code
xception in thread "main" java.lang.IllegalStateException: DecoratedWindow can only be used on JetBrainsRuntime(JBR) platform, please check the document <https://github.com/JetBrains/jewel#int-ui-standalone-theme>
But I can't run the package task (on the IDE) using JBR because it's missing jpackage.
Copy code
> Failed to check JDK distribution: 'jpackage' is missing
  JDK distribution path: /Users/su/Applications/Android <http://Studio.app/Contents/jbr/Contents/Home|Studio.app/Contents/jbr/Contents/Home>
I'm not sure why it's looking at AS JDK, as I'm using IntelliJ... Is there a way I'm missing where we need to specify the runtime to be embed?
s
To be entirely honest, I don't know. I have zero experience on this topic. It's not really a Jewel question at all... Daniele C may be able to help, since he's looked into this in other contexts
p
Thanks 🙏 I'll xprost to #compose-desktop and @ Daniele
m
I haven’t done exactly what you are trying to do but as far as I know you can define the JDK which gets bundled with your app separately from the JDK that is used for the packaging task. The bundled JDK is defined in the Gradle file like this:
Copy code
compose.desktop {
    application {
        javaHome = <Your JBR here>
What I am not absolutely sure about is whether this is also used for the packaging task but I think it’s not. If this is true, you can use a normal JDK for the build and specify your JBR as above.
s
Daniele C built this, hope it's useful as starting point. https://github.com/fourlastor-alexandria/construo Benefits, afaik: • Builds cross-platform • Bundles a JDK • Includes a native-code launcher
🙏 1
l
You might also want to try Gradle's built in JVM provisioning that since v8.4 supports the JBR as well
Copy code
kotlin {
    jvmToolchain {
        vendor = JvmVendorSpec.JETBRAINS
        languageVersion = JavaLanguageVersion.of(17)
    }
}
You might also want to use the foo-jay jdk downloader for letting Gradle download the selected jdk:
Copy code
// Settings.gradle.kts
plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
I am not sure if it can download the JBR tho.
p
Yeah, have the toolchain set up. I'm testing with this project: https://github.com/romainguy/kotlin-explorer And have the same issue. Bu tI'll probably add that to mine 🙂
l
Then probably the Compose Gradle Plugin does not use the Gradle JVM Toolchain APIs and instead uses the current running JVM to get the tools.
p
Aright, turns out that it needs JBR 17.0.9 and not 17.0.11 (I need a drink) cc: @seb not sure if this is something someone at JB may wanna have a look at 😅
s
You'd have to ask that to folks at JetBrains
In general though, always use the latest JBR
It was literally the first question I asked you on the issue you had last week, because I know it sometimes has weird bugs
p
Yeah, that was my thought too. Latest bettest 🙃 I'm so glad I managed to make it work though. I was loosing my mind. Ah, you're on G now? Soz, thought you were still on JB. We need to catch up soon 😅 Time flies.