magneticflux- / fabric-mumblelink-mod

A Fabric mod that connects to the MumbleLink plugin.
GNU Lesser General Public License v3.0
52 stars 13 forks source link

mumbleAutoLaunchOption argument crashes on MacOS #31

Closed Ecoleaf1 closed 3 years ago

Ecoleaf1 commented 4 years ago

I installed the mod onto my server, and setup where users will automatically connect to my mumble server when connecting to my minecraft server... Except my friends who are on mac will crash because of how it handles auto launching. Their game will just freeze when it says "Joining world". So far this is only a mac issue, as I am running linux (Arch Linux), and my other friends who are using windows 10 are fine. This is his log (He had to kill his minecraft process as it was stuck):

[19:46:25] [main/INFO]: Loading for game Minecraft 1.16.1
[19:46:26] [main/INFO]: [FabricLoader] Loading 57 mods: fabric-renderer-api-v1@0.2.13+eae12eb802, logical_zoom@0.0.4, fabric-keybindings-v0@0.2.0+3fa9f7c502, fabricloader@0.9.0+build.204, org_jetbrains_kotlinx_kotlinx-coroutines-core@1.3.7, lithium@0.5.1, fabric-containers-v0@0.1.8+045df74f02, fabric-object-builder-api-v1@1.5.6+a2d21ddd02, fabric-dimensions-v1@1.0.0+a71b305302, fabric-game-rule-api-v1@1.0.0+fe81e12502, fabric-api-base@0.1.3+12a8474c02, fabric-rendering-data-attachment-v1@0.1.3+b7f9825d02, fabric-textures-v0@1.0.4+eae12eb802, fabric-rendering-fluids-v1@0.1.8+b7084faa02, org_jetbrains_kotlin_kotlin-stdlib@1.3.72, fabric-blockrenderlayer-v1@1.1.4+c6a8ea8902, fabric-lifecycle-events-v1@1.1.0+013e49d202, sodium@0.1.0, fabric-renderer-registries-v1@2.0.1+5a0f9a6002, org_jetbrains_kotlin_kotlin-stdlib-jdk7@1.3.72, fabric-loot-tables-v1@1.0.0+386eb69e02, fabric@0.16.0+build.384-1.16.1, fabric-particles-v1@0.2.1+0a6f2a7002, fabric-networking-v0@0.1.10+e00ecb5f02, minecraft@1.16.1, fabric-screen-handler-api-v1@1.1.0+97324d1102, fabric-networking-blockentity-v0@0.2.5+b50ffc7b02, cloth-basic-math@0.5.1, fabric-command-api-v1@1.0.8+5ce5339802, phosphor@0.6.0+build.7, fabric-tool-attribute-api-v1@1.2.0+55e0cc5f02, org_jetbrains_kotlin_kotlin-stdlib-jdk8@1.3.72, fabric-renderer-indigo@0.3.4+34d6c87102, fabric-biomes-v1@0.2.7+059ea86602, fabric-crash-report-info-v1@0.1.2+b7f9825d02, fabric-item-api-v1@1.0.0+16acbe5b02, fabric-events-interaction-v0@0.3.3+7066030f02, fabric-language-kotlin@1.3.72+build.1, fabric-rendering-v0@1.1.0+5341049002, fabric-rendering-v1@1.1.2+346247d702, fabric-key-binding-api-v1@1.0.1+f404f3be02, cloth-config2@4.5.6, org_jetbrains_kotlinx_kotlinx-coroutines-jdk8@1.3.7, autoconfig1u@3.2.0-unstable, fabric-resource-loader-v0@0.2.6+f41e209802, org_jetbrains_kotlin_kotlin-reflect@1.3.72, fabric-content-registries-v0@0.1.9+059ea86602, fabric-tag-extensions-v0@0.2.7+a4c57d8e02, fabric-registry-sync-v0@0.3.8+7dba2d6c02, fabric-commands-v0@0.2.0+52d3083602, fabric-mining-levels-v0@0.1.2+b764ce9902, fabric-events-lifecycle-v0@0.2.0+16acbe5b02, fabric-models-v0@0.1.0+dfdb52d602, fabric-item-groups-v0@0.2.0+438f963602, fabric-object-builders-v0@0.6.1+a2d21ddd02, fabric-mumblelink-mod@0.7.2, org_jetbrains_annotations@17.0.0
[19:46:26] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8 Source=file:/Applications/MultiMC.app/Contents/MacOS/libraries/net/fabricmc/sponge-mixin/0.8+build.18/sponge-mixin-0.8+build.18.jar Service=Knot/Fabric Env=CLIENT
[19:46:26] [main/INFO]: Loaded configuration file for Sodium (38 options available, 0 user overrides)
[19:46:26] [main/INFO]: Sodium has been successfully discovered and initialized -- your game is now faster!
[19:46:26] [main/INFO]: Loaded configuration file for Lithium: 54 options available, 0 override(s) found
[19:46:26] [main/WARN]: @Mixin target net/minecraft/class_3898$class_3208 is public in fabric-networking-v0.mixins.json:MixinEntityTracker and should be specified in value
[19:46:31] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
[19:46:31] [main/INFO]: Setting user: Scarytheglitch
[19:46:32] [main/INFO]: [Indigo] Different rendering plugin detected; not applying Indigo.
[19:46:32] [main/INFO]: Backend library: LWJGL version 3.2.2 build 10
[19:46:34] [main/INFO]: Reloading ResourceManager: Default, Fabric Renderer API (v1), Logical Zoom, Fabric Key Bindings (v0), Fabric Loader, Lithium, Fabric Containers (v0), Fabric Object Builder API (v1), Fabric Game Rule API (v1), Fabric API Base, Fabric Rendering Data Attachment (v1), Fabric Textures (v0), Fabric Rendering Fluids (v1), Fabric BlockRenderLayer Registration (v1), Fabric Lifecycle Events (v1), Sodium, Fabric Renderer Registries (v1), Fabric Loot Tables (v1), Fabric API, Fabric Networking (v0), Fabric Screen Handler API (v1), Fabric Networking Block Entity (v0), Phosphor, Fabric Tool Attribute API (v1), Fabric Renderer - Indigo, Fabric Biomes (v1), Fabric Crash Report Info (v1), Fabric Item API (v1), Fabric Events Interaction (v0), Fabric Language Kotlin, Fabric Rendering (v0), Fabric Rendering (v1), Fabric Key Binding API (v1), Cloth Config v4, Auto Config v1 Updated, Fabric Resource Loader (v0), Fabric Content Registries (v0), Fabric Tag Extensions (v0), Fabric Registry Sync (v0), Fabric Mining Levels (v0), Fabric Events Lifecycle (v0), Fabric Models (v0), Fabric Item Groups (v0), Fabric Object Builders (v0), MumbleLink
[19:46:49] [main/INFO]: OpenAL initialized.
[19:46:49] [main/INFO]: Sound engine started
[19:46:50] [main/INFO]: Created: 1024x1024x4 minecraft:textures/atlas/blocks.png-atlas
[19:46:50] [main/INFO]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas
[19:46:50] [main/INFO]: Created: 1024x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
[19:46:50] [main/INFO]: Created: 1024x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
[19:46:50] [main/INFO]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
[19:46:50] [main/INFO]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
[19:46:50] [main/INFO]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[19:46:51] [main/INFO]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas
[19:46:51] [main/INFO]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
[19:46:51] [main/INFO]: Created: 256x128x0 minecraft:textures/atlas/mob_effects.png-atlas
[19:47:01] [main/INFO]: Connecting to smp.wigoftime.net, 25608
[19:47:03] [main/INFO]: Started 8 worker threads
[19:47:03] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
Process was killed by user.
magneticflux- commented 4 years ago

Are there any other logs you can provide? Can you share the URL template you are using (redacting any sensitive information)? What version of Java are they using to run Minecraft?

Ecoleaf1 commented 4 years ago

He is using java 14, and for the URL Template, i am assuming my server arguments in the mumblelink config? His Minecraft would freeze and won't respond whenever he was up to "Joining World" with my server setup. He would eventually time out however his Minecraft would still be frozen and have to kill the process. I made him join other servers, but the bug only appears on my server that has the mod installed and has the mentioned setup. This is true with other mac users as well, same story (Only on mac, Linux and windows are fine).

java

I assume it is getting confused on how to control the mumble client on mac, as when i set mumbleAutoLaunchOption to "IGNORE", mac users can now join the game. Even though they have to join manually, the mumble link itself is fine, but it won't move the mac users into different channels on my mumble server either.

Server side:

mumbleAutoLaunchOption = "ACCEPT"
mumbleDimensionYAxisAdjust = 0.0
voipClient = "MUMBLE"
mumbleServerHost = "{My Mumble Server Address}"
mumbleServerPort = {My Mumble Server Port}
mumbleServerPath = "/Minecraft Survival/{2}"

Client side config setup:

mumbleAutoLaunchOption = "ACCEPT"
mumbleDimensionYAxisAdjust = 0.0
voipClient = "MUMBLE"

For mac users, i had them setup this as a temp solution (client-side for mac):

mumbleAutoLaunchOption = "IGNORE"
mumbleDimensionYAxisAdjust = 0.0
voipClient = "MUMBLE"
Server log (ScaryTheGlitch is one of the mac users):
[09:12:25] [main/INFO]: Loading for game Minecraft 1.16.1
[09:12:26] [main/INFO]: [FabricLoader] Loading 55 mods: fabric-renderer-api-v1@0.2.13+eae12eb802, fabric-keybindings-v0@0.2.0+3fa9f7c502, fabricloader@0.9.2+build.206, org_jetbrains_kotlinx_kotlinx-coroutines-core@1.3.7, lithium@0.5.1, fabric-containers-v0@0.1.8+045df74f02, fabric-object-builder-api-v1@1.5.6+a2d21ddd02, fabric-dimensions-v1@1.0.0+a71b305302, fabric-game-rule-api-v1@1.0.0+fe81e12502, fabric-api-base@0.1.3+12a8474c02, fabric-rendering-data-attachment-v1@0.1.3+b7f9825d02, fabric-textures-v0@1.0.4+eae12eb802, fabric-rendering-fluids-v1@0.1.8+b7084faa02, org_jetbrains_kotlin_kotlin-stdlib@1.3.72, fabric-blockrenderlayer-v1@1.1.4+c6a8ea8902, fabric-lifecycle-events-v1@1.1.0+013e49d202, fabric-renderer-registries-v1@2.0.1+5a0f9a6002, org_jetbrains_kotlin_kotlin-stdlib-jdk7@1.3.72, fabric-loot-tables-v1@1.0.0+386eb69e02, fabric@0.16.0+build.384-1.16.1, fabric-particles-v1@0.2.1+0a6f2a7002, fabric-networking-v0@0.1.10+e00ecb5f02, fabric-screen-handler-api-v1@1.1.0+97324d1102, minecraft@1.16.1, fabric-networking-blockentity-v0@0.2.5+b50ffc7b02, cloth-basic-math@0.5.1, fabric-command-api-v1@1.0.8+5ce5339802, phosphor@0.6.0+build.7, fabric-tool-attribute-api-v1@1.2.0+55e0cc5f02, org_jetbrains_kotlin_kotlin-stdlib-jdk8@1.3.72, fabric-renderer-indigo@0.3.4+34d6c87102, fabric-biomes-v1@0.2.7+059ea86602, fabric-item-api-v1@1.0.0+16acbe5b02, fabric-events-interaction-v0@0.3.3+7066030f02, fabric-crash-report-info-v1@0.1.2+b7f9825d02, fabric-language-kotlin@1.3.72+build.1, fabric-rendering-v0@1.1.0+5341049002, fabric-rendering-v1@1.1.2+346247d702, fabric-key-binding-api-v1@1.0.1+f404f3be02, cloth-config2@4.5.6, org_jetbrains_kotlinx_kotlinx-coroutines-jdk8@1.3.7, autoconfig1u@3.2.0-unstable, fabric-resource-loader-v0@0.2.6+f41e209802, org_jetbrains_kotlin_kotlin-reflect@1.3.72, fabric-content-registries-v0@0.1.9+059ea86602, fabric-tag-extensions-v0@0.2.7+a4c57d8e02, fabric-registry-sync-v0@0.3.8+7dba2d6c02, fabric-commands-v0@0.2.0+52d3083602, fabric-mining-levels-v0@0.1.2+b764ce9902, fabric-events-lifecycle-v0@0.2.0+16acbe5b02, fabric-models-v0@0.1.0+dfdb52d602, fabric-item-groups-v0@0.2.0+438f963602, fabric-object-builders-v0@0.6.1+a2d21ddd02, fabric-mumblelink-mod@0.7.2, org_jetbrains_annotations@17.0.0
[09:12:27] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.1 Source=file:/home/minecraft/multicraft/servers/server134409/fabric-server-launch.jar Service=Knot/Fabric Env=SERVER
[09:12:31] [main/WARN]: @Mixin target net/minecraft/class_3898$class_3208 is public in fabric-networking-[09:12:55] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
[09:12:58] [main/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[09:12:58] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[09:12:58] [main/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[09:12:58] [main/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[09:12:58] [main/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[09:12:58] [main/INFO]: Reloading ResourceManager: Default, bukkit, Fabric Tool Attribute API (v1)
[09:13:03] [Worker-Main-10/INFO]: Loaded 7 recipes
[09:13:08] [Worker-Main-10/INFO]: Loaded 927 advancements
[09:13:15] [Server thread/INFO]: Starting minecraft server version 1.16.1
[09:13:15] [Server thread/INFO]: Loading properties
[09:13:15] [Server thread/INFO]: Default game type: SURVIVAL
[09:13:15] [Server thread/INFO]: Generating keypair
[09:13:18] [Server thread/INFO]: Starting Minecraft server on 0.0.0.0:25608
[09:13:18] [Server thread/INFO]: Using epoll channel type
[09:13:19] [Server thread/INFO]: Preparing level "world"
[09:13:21] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:30] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:33] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:33] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:33] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:33] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:33] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:33] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:34] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:34] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:34] [Server thread/INFO]: Preparing spawn area: 0%
[09:13:35] [Server thread/INFO]: Preparing spawn area: 8%
[09:13:35] [Server thread/INFO]: Preparing spawn area: 8%
[09:13:37] [Server thread/INFO]: Time elapsed: 15275 ms
[09:13:37] [Server thread/INFO]: Done (18.016s)! For help, type "help"
[09:13:40] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2621ms or 52 ticks behind
[09:15:13] [User Authenticator #1/INFO]: UUID of player Ecoleaf is 3a401966-852e-4dd5-b9e7-d976f6cc7685
[09:15:14] [Server thread/INFO]: Ecoleaf[/121.214.103.19:45090] logged in with entity id 82 at (1065.3439814479732, 82.0, -623.5438055231798)
[09:15:14] [Server thread/INFO]: Ecoleaf joined the game
[09:15:16] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2291ms or 45 ticks behind
[09:15:19] [Server thread/INFO]: <Ecoleaf> .
[09:15:40] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 9553ms or 191 ticks behind
[09:15:55] [Server thread/INFO]: [Ecoleaf: Whitelist is now turned off]
[09:15:58] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2865ms or 57 ticks behind
[09:16:58] [Server thread/INFO]: <Ecoleaf> .
[09:17:20] [Server thread/INFO]: <Ecoleaf> .
[09:23:33] [Server thread/INFO]: <Ecoleaf> .
[09:27:24] [User Authenticator #3/INFO]: UUID of player Scarytheglitch is bb298b8f-23da-4fe0-8e33-a4374e311371
[09:27:24] [Server thread/INFO]: Scarytheglitch[/124.189.204.47:53862] logged in with entity id 3005 at (-17.624281828915056, 12.5625, -2074.2166958945995)
[09:27:24] [Server thread/INFO]: Scarytheglitch joined the game
[09:27:28] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2002ms or 40 ticks behind
[09:27:54] [Server thread/INFO]: Scarytheglitch lost connection: Disconnected
[09:27:54] [Server thread/INFO]: Scarytheglitch left the game
[09:29:07] [User Authenticator #5/INFO]: UUID of player Ecoleaf is 3a401966-852e-4dd5-b9e7-d976f6cc7685
[09:29:07] [Server thread/INFO]: Ecoleaf[/121.214.103.19:45154] logged in with entity id 4039 at (1106.3409224847508, 70.0, -574.4184173805651)
[09:29:07] [Server thread/INFO]: Ecoleaf joined the game
[09:29:20] [Server thread/INFO]: Ecoleaf lost connection: Disconnected
[09:29:20] [Server thread/INFO]: Ecoleaf left the game
[09:30:24] [User Authenticator #6/INFO]: UUID of player Ecoleaf is 3a401966-852e-4dd5-b9e7-d976f6cc7685
[09:30:24] [Server thread/INFO]: Ecoleaf[/121.214.103.19:45190] logged in with entity id 4466 at (1106.3409224847508, 70.0, -574.4184173805651)
[09:30:24] [Server thread/INFO]: Ecoleaf joined the game
[09:30:26] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2005ms or 40 ticks behind
[09:31:07] [Server thread/INFO]: Ecoleaf lost connection: Disconnected
[09:31:07] [Server thread/INFO]: Ecoleaf left the game
[09:31:21] [User Authenticator #7/INFO]: UUID of player Ecoleaf is 3a401966-852e-4dd5-b9e7-d976f6cc7685
[09:31:22] [Server thread/INFO]: Ecoleaf[/121.214.103.19:45204] logged in with entity id 5269 at (1106.3409224847508, 70.0, -574.4184173805651)
[09:31:22] [Server thread/INFO]: Ecoleaf joined the game
[09:31:26] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2036ms or 40 ticks behind
[09:31:57] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2350ms or 47 ticks behind
[09:33:03] [Server thread/INFO]: <Ecoleaf> and u will automatically connect to the mumble server when u join this server :3
[09:33:22] [Server thread/INFO]: Ecoleaf lost connection: Timed out
[09:33:22] [Server thread/INFO]: Ecoleaf left the game
[09:33:25] [User Authenticator #8/INFO]: UUID of player Ecoleaf is 3a401966-852e-4dd5-b9e7-d976f6cc7685
[09:33:25] [Server thread/INFO]: Ecoleaf[/121.214.103.19:45222] logged in with entity id 6462 at (1075.2859292348624, 77.0, -607.9113011313926)
[09:33:25] [Server thread/INFO]: Ecoleaf joined the game
[09:33:42] [User Authenticator #9/INFO]: UUID of player Scarytheglitch is bb298b8f-23da-4fe0-8e33-a4374e311371
[09:33:42] [Server thread/INFO]: Scarytheglitch[/124.189.204.47:49397] logged in with entity id 6829 at (-17.624281828915056, 12.5625, -2074.2166958945995)
[09:33:42] [Server thread/INFO]: Scarytheglitch joined the game
[09:34:11] [Server thread/INFO]: Scarytheglitch has reached the goal [Zombie Doctor]
[09:34:11] [Server thread/INFO]: Scarytheglitch lost connection: Disconnected
[09:34:11] [Server thread/INFO]: Scarytheglitch left the game
magneticflux- commented 4 years ago

Could you put me in touch with the macOS user that reported the issue? I've tested on macOS in the past and everything seemed fine, but I don't have a macOS system available right now to do debugging myself (and they're notoriously difficult to acquire if you don't have an Apple computer). I'd like to have them build custom versions that print more logging info and see if I can see anything interesting happening.

magneticflux- commented 3 years ago

The freezing issue might be related to use of AWT code which was resolved with https://github.com/magneticflux-/fabric-mumblelink-mod/pull/33. I'll assume it's fixed and close this as it's out of date, but if there's more info I'll reopen and we can investigate further.

Mask commented 3 years ago

I have encountered this too with MacOS + fabric-link-mod 0.8.4 (no Optifine, no other mods except, of course, fabric+api) - @magneticflux- would you like to re-open this or should I create a new issue?

Here's my analysis:

This has been discussed at length in https://github.com/libgdx/libgdx/issues/6542 and http://forum.lwjgl.org/index.php?topic=6872.0 - this usually comes down to "avoid using AWT in LWJGL applications".

My suggestion is to adapt the solution in http://forum.lwjgl.org/index.php?PHPSESSID=oh9l0sspe5ednq71f806qua0t3&topic=6872.msg36188#msg36188 - replacing

ensureNotHeadless()
Desktop.getDesktop().browse(uri)

with

            if (Platform.get() == Platform.MACOSX) {
                val objcMsgSend = ObjCRuntime.getLibrary().getFunctionAddress("objc_msgSend")

                // Implements the following Obj-C code using the Obj-C Runtime:
                // [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: @"https://www.lwjgl.org"]];
                stackPush().use { stack ->
                    val string = CFStringCreateWithCStringNoCopy(
                        kCFAllocatorDefault,
                        stack.UTF8(uri.toASCIIString()),
                        kCFStringEncodingUTF8,
                        kCFAllocatorNull
                    )
                    val sharedWorkspace: Long =
                        invokePPP(objcMsgSend, objc_getClass("NSWorkspace"), sel_getUid("sharedWorkspace"))
                    val url: Long =
                        invokePPPP(objcMsgSend, objc_getClass("NSURL"), sel_getUid("URLWithString:"), string)
                    val result: Int = invokePPPI(objcMsgSend, sharedWorkspace, sel_getUid("openURL:"), url)
                    CFRelease(string)
                }
            } else {
                ensureNotHeadless()
                Desktop.getDesktop().browse(uri)
            }

This works like on charm on my 10.15.7 MacOS.

Mask commented 3 years ago

Update: this implementation is less "spooky" than the above and works on my machine just as well:

            if (Platform.get() == Platform.MACOSX) {
                ProcessBuilder("open", uri.toString()).start()
            } else {
                ensureNotHeadless()
                Desktop.getDesktop().browse(uri)
            }
magneticflux- commented 3 years ago

@Mask I've created #78 to centralize info about AWT-using mods.