I know a Java app can be bundled as a Mac app with the user-interface driven by Java Swing or JavaFX, and a Java runtime (JRE) bundled. But I want to build a native app in Xcode written in Swift with a Cocoa user-interface that calls upon a Java library to process some data.
I need to invoke the bundled JRE, call the desired library (JAR file), pass a reference to a file in the Mac’s storage (or else the file’s content as a large String in memory), and get back a string (XML or CSV or tab-delimited data).
This Question is similar to this Question but updated for Swift and the modern macOS and Java 8.