Hello everyone, I have a question about Jewel. Jet...
# jewel
c
Hello everyone, I have a question about Jewel. Jetbrains's Jewel needs to be added to the JBR runtime to run on compose, but when using gradlew packageDmg on a Mac system, it will prompt that jpackage is missing, which will fail to build the product unless jewel is deleted. JBR's reply is "Indeed jbr_jcef, that is integrated into IDEs distributions, does not have jpackage. jbr_jcef is used as a runtime to launch IDEs. So most components required for developing was removed to keep distribution size as small as possible." However, JB's open source JEWEL integration requires JBR, which leads to the problem. I have raised related issues, and there are currently two solutions 1. Cross-compile and package via "contruo plugin", but I haven't tried it yet, it's a bit complicated 2. Use "conveyor" to package the Mac product Dmg, which feels okay, but I still want to package it through gradlew's packageDmg Here are the links and references to the related issues I raised https://github.com/JetBrains/jewel/pull/289 https://github.com/JetBrains/jewel/issues/709 https://github.com/JetBrains/JetBrainsRuntime/issues/477 Does anyone know how to package on a Mac after using jewel? If you know, please tell me. Thank you very much.
s
We don't have any officially recommended nor supported way to create packaged distributions across platforms, as we already replied to you on the issues. If someone from the community has ideas (such as the Construo plugin) you can try that, but we do not support nor can help with those
c
OK, thanks, I'll try to strip the JBR runtime environment from Jewel-window first
s
As far as I am aware, the Construo mechanism works to cross-compile, and was created because other ways didn't really work. That said, it should be theoretically possible to get things to work in other ways, but we have no experience doing that on the team
m
I once tried this with my own application on a Mac and I think it worked. You just have to configure the JBR in the gradle file like this:
Copy code
compose.desktop {
    application {
        mainClass = "MainKt"
        javaHome = "/Users/mpaus/Downloads/Software/Java/OpenJDK/jbrsdk-21.0.3-osx-x64-b509.11/Contents/Home/"
...
That means you have to configure a different, normal JDK with jpackage for building and packaging and the JBR only as the target to be bundled with the application. I did that some time ago on a Mac and it seemed to work. You also have to configure a higher ProGuard version than the default one in order to be able to use Java 19 or higher.
c
Thank you very much. Now the packaging is successful. When running gradle as jvm, select jbr. When configuring gradle, select ordinary jdk. Now there is a problem that the packaged dmg cannot be opened if it contains jewel. I can't find the error message. When you use this in your own project, can you explain the environment jdk and obfuscated version? Thank you very much. I will refer to it. @Michael Paus Or do you have any open source projects I would like to refer to? Thank you
@Michael Paus build.gradle.kts. ---> config openjdk
Copy code
javaHome = "/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/"
The dmg package was successfully packaged, but the running prompt
Copy code
Exception 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>
	at org.jetbrains.jewel.window.DecoratedWindowKt.DecoratedWindow(DecoratedWindow.kt:65)
	at com.crow.mordecaix.ComposableSingletons$MainKt$lambda-2$1$1$1.invoke(Main.kt:53)
	at com.crow.mordecaix.ComposableSingletons$MainKt$lambda-2$1$1$1.invoke(Main.kt:52)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:401)
	at androidx.compose.material3.TextKt.ProvideTextStyle(Text.kt:349)
	at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:69)
	at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:68)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
	at androidx.compose.material3.MaterialThemeKt.MaterialTheme(MaterialTheme.kt:60)
	at com.crow.mordecaix.ui.theme.MordecaiXThemeKt.MordecaiXTheme(MordecaiXTheme.kt:50)
	at com.crow.mordecaix.ui.theme.MordecaiXThemeKt.MordecaiXTheme(MordecaiXTheme.kt:42)
	at com.crow.mordecaix.ComposableSingletons$MainKt$lambda-2$1$1.invoke(Main.kt:52)
	at com.crow.mordecaix.ComposableSingletons$MainKt$lambda-2$1$1.invoke(Main.kt:51)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at org.jetbrains.jewel.intui.standalone.theme.IntUiThemeKt$IntUiTheme$2$1.invoke(IntUiTheme.kt:240)
	at org.jetbrains.jewel.intui.standalone.theme.IntUiThemeKt$IntUiTheme$2$1.invoke(IntUiTheme.kt:239)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
	at org.jetbrains.jewel.intui.standalone.theme.IntUiThemeKt$IntUiTheme$2.invoke(IntUiTheme.kt:236)
	at org.jetbrains.jewel.intui.standalone.theme.IntUiThemeKt$IntUiTheme$2.invoke(IntUiTheme.kt:235)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
	at org.jetbrains.jewel.ui.theme.JewelThemeKt$BaseJewelTheme$2$1.invoke(JewelTheme.kt:151)
	at org.jetbrains.jewel.ui.theme.JewelThemeKt$BaseJewelTheme$2$1.invoke(JewelTheme.kt:150)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
	at org.jetbrains.jewel.ui.theme.JewelThemeKt$BaseJewelTheme$2.invoke(JewelTheme.kt:150)
	at org.jetbrains.jewel.ui.theme.JewelThemeKt$BaseJewelTheme$2.invoke(JewelTheme.kt:149)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
	at org.jetbrains.jewel.foundation.theme.JewelThemeKt.JewelTheme(JewelTheme.kt:57)
	at org.jetbrains.jewel.foundation.theme.JewelThemeKt$JewelTheme$1.invoke(JewelTheme.kt:52)
	at org.jetbrains.jewel.foundation.theme.JewelThemeKt$JewelTheme$1.invoke(JewelTheme.kt:52)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:401)
	at org.jetbrains.jewel.foundation.theme.JewelThemeKt.JewelTheme(JewelTheme.kt:52)
	at org.jetbrains.jewel.ui.theme.JewelThemeKt.BaseJewelTheme(JewelTheme.kt:149)
	at org.jetbrains.jewel.intui.standalone.theme.IntUiThemeKt.IntUiTheme(IntUiTheme.kt:235)
	at com.crow.mordecaix.ComposableSingletons$MainKt$lambda-2$1.invoke(Main.kt:43)
	at com.crow.mordecaix.ComposableSingletons$MainKt$lambda-2$1.invoke(Main.kt:40)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:116)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.ui.window.Application_desktopKt$application$1$1.invoke(Application.desktop.kt:117)
	at androidx.compose.ui.window.Application_desktopKt$application$1$1.invoke(Application.desktop.kt:116)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:116)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1$1.invoke(Application.desktop.kt:233)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1$1.invoke(Application.desktop.kt:232)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:380)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:223)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:221)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jb.kt:33)
	at androidx.compose.runtime.ActualJvm_jvmKt__ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:36)
	at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(Unknown Source)
	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3595)
	at androidx.compose.runtime.ComposerImpl.composeContent$runtime(Composer.kt:3522)
	at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:743)
	at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1122)
	at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:649)
	at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:635)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2.invokeSuspend(Application.desktop.kt:221)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Failed to launch JVM
m
It looks like you did not actually package the JBR or otherwise I don’t understand the error message. Could you print out something like this in your app?
Copy code
<http://log.info|log.info> { "java.vm.name: ${System.getProperty("java.vm.name", "(undefined)")}" }
<http://log.info|log.info> { "java.runtime.version: ${System.getProperty("java.runtime.version", "(undefined)")}" }
<http://log.info|log.info> { "os.name: ${System.getProperty("os.name", "(undefined)")}" }
<http://log.info|log.info> { "os.arch: ${System.getProperty("os.arch", "(undefined)")}" }
<http://log.info|log.info> { "java.vendor: ${System.getProperty("java.vendor", "(undefined)")}" }
c
@Michael Paus javaHome = "/Users/crowforkotlin/Downloads/jbrsdk-21.0.3-osx-aarch64-b446.1/Contents/Home/"
@Michael Paus
Copy code
java.vm.name: OpenJDK 64-Bit Server VM
java.runtime.version: 17.0.1+12-39
os.name: Mac OS X
os.arch: aarch64
java.vendor: Oracle Corporation
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See <https://www.slf4j.org/codes.html#noProviders> for further details.
Exception 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>
m
That’s the wrong JDK in you bundled app. Its from Oracle and not JetBrains.
c
how to config , i already config on gradle.kts
Copy code
javaHome = "/Users/crowforkotlin/Downloads/jbrsdk-21.0.3-osx-aarch64-b446.1/Contents/Home/"
this jbr sdk download from jetbrains runtime github
openjdk 17.0.11 2024-04-16 OpenJDK Runtime Environment JBR-17.0.11+1-1207.30-nomod (build 17.0.11+1-b1207.30) OpenJDK 64-Bit Server VM JBR-17.0.11+1-1207.30-nomod (build 17.0.11+1-b1207.30, mixed mode, sharing) tip : Exception in thread "main" java.lang.IllegalStateException: DecoratedWindow can only be used on JetBrainsRuntime(JBR) platform ---------------- openjdk 17.0.12 2024-07-16 OpenJDK Runtime Environment JBR-17.0.12+7-1000.54-nomod (build 17.0.12+7-b1000.54) OpenJDK 64-Bit Server VM JBR-17.0.12+7-1000.54-nomod (build 17.0.12+7-b1000.54, mixed mode) tip : Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /Applications/mordecaix.app/Contents/app/libskiko-macos-arm64.dylib at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source) at java.base/java.lang.Runtime.load0(Unknown Source) at java.base/java.lang.System.load(Unknown Source) at org.jetbrains.skiko.Library.loadLibraryOrCopy(Library.kt:17) at org.jetbrains.skiko.Library.findAndLoad(Library.kt:83) at org.jetbrains.skiko.Library.load(Library.kt:56) at org.jetbrains.skia.impl.Library$Companion.staticLoad(Library.jvm.kt:12) at androidx.compose.ui.ConfigureSwingGlobalsForCompose_desktopKt.configureSwingGlobalsForCompose(ConfigureSwingGlobalsForCompose.desktop.kt:49) at androidx.compose.ui.ConfigureSwingGlobalsForCompose_desktopKt.configureSwingGlobalsForCompose$default(ConfigureSwingGlobalsForCompose.desktop.kt:38) at androidx.compose.ui.window.Application_desktopKt.application(Application.desktop.kt:112) at androidx.compose.ui.window.Application_desktopKt.application$default(Application.desktop.kt:107) at com.crow.mordecaix.MainKt.main(Main.kt:40) at com.crow.mordecaix.MainKt.main(Main.kt)
m
It’s already some time ago when I did that and I can’t get it running anymore too at the moment because I neither use jewel nor do I still have that specific jbrsdk. I think there was a reason that I finally gave up on jewel.
c
still not woking
s
Hello @crowforkotlin - I have been facing what I think is the exact same issue. Indicating in my settings the correct JBR SDK but at runtime it just seems to no be bundled and I get the same exception when launching the app
Exception in thread "main" java.lang.IllegalStateException: DecoratedWindow can only be used on JetBrainsRuntime(JBR) platform
did you do some further findings since then on this ?
c
@sami daik Alas, it's very troublesome, there is no other way. Writing this kind of script in github action will 100% report an error, but you can use the method I recommend to solve the above problem, but the effect may not be very good. 1. Cross-compile and package through "contruo plugin", but I haven't tried it yet, it's a bit complicated 2. Use "conveyor" to package Mac product Dmg, it feels okay, but I still want to package it through gradlew's packageDmg
u
https://github.com/kdroidFilter/KmpRealTimeLogger Personally I didn't have any problem, I do it via github actions
s
Ha, thanks all, very interesting, So i also use Conveyor & added to the
conveyor.conf
file:
Copy code
jvm {
    feature-version = 17
    version = "17.0.11+120730"
    linux.aarch64.glibc.inputs += "<https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-17.0.11-linux-aarch64-b1207.30.tar.gz>"
    linux.amd64.glibc.inputs += "<https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-17.0.11-linux-x64-b1207.30.tar.gz>"
    linux.amd64.muslc.inputs += "<https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-17.0.11-linux-musl-aarch64-b1207.30.tar.gz>"
    mac.aarch64.inputs += "<https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-17.0.11-osx-aarch64-b1207.30.tar.gz>"
    mac.amd64.inputs += "<https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-17.0.11-osx-x64-b1207.30.tar.gz>"
    windows.amd64.inputs += "<https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-17.0.11-windows-x64-b1207.30.tar.gz>"
  }
My Github Action uses
Copy code
- name: Setup JBR 17
  uses: actions/setup-java@v4
  with:
    distribution: 'jetbrains'
    java-version: 17
    token: ${{ secrets.GITHUB_TOKEN }}
    java-package: 'jdk'
    cache: gradle
my Proguard has
Copy code
-keep class com.jetbrains.JBR* { *; }
-dontnote com.jetbrains.JBR*
When i run the app form IntelliJ using JBR , all good. But the packaging always results in this error when launching it Is there any other config i may be missing for the Conveyor packaging using JBR ?