soderbjorn
08/10/2023, 1:14 PM./gradlew :desktopApp:run
). The reason is I want to export Apple EAWT classes to enable me to use touchpad gestures as well as set a custom handler on the default About menu item. I'm beating my head against a wall though, have googled like crazy but no method seems to work. Does anyone know how to add Java compile time arguments to the desktop app Gradle task? Thanks in advance. 🙂
I tried both the jvmArgs
and args
inside compose.desktop { application } }
but I think that is just setting the runtime JVM arguments and program runtime arguments,
I also unsuccessfully tried stuff like this inside the desktop Gradle build file:
tasks.withType<JavaCompile> {
val compilerArgs = options.compilerArgs
compilerArgs.add("--add-exports java.desktop/com.apple.eawt=ALL_UNNAMED")
}
soderbjorn
08/10/2023, 1:25 PMException in thread "main" java.lang.IllegalAccessError: class com.test.test.ComposableSingletons$MainKt$lambda-1$1 (in unnamed module @0x7ee7980d) cannot access class com.apple.eawt.Application (in module java.desktop) because module java.desktop does not export com.apple.eawt to unnamed module @0x7ee7980d
at com.bontouch.bonteams.ComposableSingletons$MainKt$lambda-1$1.invoke(main.kt:22)
Alexander Maryanovsky
08/10/2023, 4:28 PMAlexander Maryanovsky
08/10/2023, 4:29 PMsoderbjorn
08/10/2023, 8:24 PMsoderbjorn
08/10/2023, 8:25 PMsoderbjorn
08/10/2023, 8:39 PMsoderbjorn
08/10/2023, 9:50 PMsoderbjorn
08/10/2023, 10:16 PM_compose_._desktop_ *{*
application *{*
mainClass = "MainKt"
jvmArgs("--add-opens=java.desktop/com.apple.eawt.event=ALL-UNNAMED")
args("-XDignore.symbol.file --add-exports java.desktop/com.apple.eawt.event=ALL-UNNAMED")
The key was to add a =
between --add-opens
and the package name. I have no idea why this was needed for the Gradle task but not for the manual launch job, they looked identical in the final logs. Must be some weird difference of invocation.