How to integrate native Java backend with macOS catalyst app UI?
- My UI is SwiftUI/macCatalyst, using entitlements for voice recognition and microphone.
- My back-end is from a large legacy Java code base rendered to native x86_64 binary.
- For now they interface via stdio streams established by the native java command launching the UI app.
- This works fine when the Java code runs on a JDK.
- When native backend launches the UI app, the UI app fails to secure permissions (but otherwise works fine)
- Same result when the backend is bundled with the app as if a command-line tool
Solution constraints:
- Unlike the sample app/docs that integrate a command-line tool into an app, this binary cannot be built using XCode's Clang
- I'd like to continue using macCatalyst, knowing this can't be deployed to iOS proper, only to macOS.
- I can make the UI launch the backend, but don't want to do this without some assurance it would fix things :)
- I'd rather not work through the calling conventions/wrappers to staticly link these binaries now.
Assuming the parent process needs the app entitlements, I tried:
- To embed the java binary into the SwiftUI app?:
- Following instructions for embedding a command-line app did not configure the backend binary with the entitlements?
- Deploy the java binary standalone as an app with the proper entitlements?
- Similar to above: unable to figure out how
Pointers to docs welcome. I've seen
Ideally I'd like to know how to deliver an app whose binary is entirely build using Java native (including proper entitle/sign/credential/notorize/sandbox...)
Thanks!
But I don't know enough about Apple code signing and validation to know if I can sign and deploy (on the app store?) an app with an embedded java native binary, since it wasn't built with Apple's Clang.
Neither macOS nor the App Store require that programs be build with Clang. Java apps can be distributed independently (with Developer ID signing) and on the App Store.
Having said that, packaging and signing Java apps in a way that passes notarisation and Gatekeeper (for independent distribution) or the App Store ingestion process (for App Store distribution) can be a challenge. I have posted a bunch of general info about that here on DevForums (URLs below) but I don’t have any Java-specific advice. For that front, I recommend that you consult the support resources provided by your Java runtime vendor.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"