Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » RCP App + java.awt.Desktop#setOpenUriHandler on MacOS(Advice in tracking down the issue related to URI scheme calls handling in RCP app.)
RCP App + java.awt.Desktop#setOpenUriHandler on MacOS [message #1842794] Thu, 01 July 2021 13:13 Go to next message
Aleksei Airapetov is currently offline Aleksei AirapetovFriend
Messages: 13
Registered: December 2019
Junior Member
Hi, I'm currently developing and testing a small RCP App example, which can handle custom URI scheme calls on MacOS.

I use method to register custom URI handler in the code.
But I'm facing a problem which is that the handler does not being called.

The symptoms are as follows:

  • with debugger, I made sure that the handler registration code is being executed (can't tell if it is being executed properly, because it calls native method under the hood, but no exceptions are thrown during the call of Desktop#setOpenUriHandler)
  • I am convinced that the URI call is executed properly on the side of the OS (when I enter custom URL in browser, OS suggests to open my application and brings its window to front)
  • However, the code inside the handler is not being executed

I tried to call the handler registering method from different places in my code (in bundle Activator, in ViewPart#createControl method, and also tried to create declarative service and call it there) but still no effect.

I am also attaching archive with my whole project.
One can reproduce the issue following these steps:

  • build project by calling: mvn clean install
  • launch eclipse-repository/target/products/
  • try to call custom URI by entering example://test in your browser address bar
  • by this point the application window should display entered URL which however is not happening

Tested it on MacOS Big Sur with openjdk 11.0.11

Maybe someone faced such problem before? Any tips are welcome, thanks.
Re: RCP App + java.awt.Desktop#setOpenUriHandler on MacOS [message #1842797 is a reply to message #1842794] Thu, 01 July 2021 14:48 Go to previous messageGo to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 260
Registered: April 2012
Senior Member
Eclipse is not implemented on AWT, it uses SWT. I can imagine that the AWT handler is (by default) not instantiated correctly in Eclipse. In general mixing SWT and AWT is complex.

Never used it myself yet, but Eclipse offers its own implementation to add Link Handlers, see
Re: RCP App + java.awt.Desktop#setOpenUriHandler on MacOS [message #1842890 is a reply to message #1842797] Mon, 05 July 2021 11:32 Go to previous message
Michael Frank is currently offline Michael FrankFriend
Messages: 13
Registered: February 2021
Junior Member
Adding to Rolf's answer, did you see that "note" in the documentation:
Please note that for macOS, notifications are only sent if the Java app is a bundled application, with a CFBundleDocumentTypes array present in its Info.plist. Check the Apple Developer Documentation for more information about Info.plist.

I can't tell from your provided code if you bundled it correctly or not.
Previous Topic:How to install Tycho on top Maven
Next Topic:Plugin/Feature not loaded
Goto Forum:

Current Time: Sat May 25 15:28:23 GMT 2024

Powered by FUDForum. Page generated in 0.03172 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top