title: Call Java from Swift in Xcode app
body: <p>I know a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/package_for_mac.html" rel="nofollow noreferrer">Java app can be bundled as a Mac app</a> 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. </p>
  
  <p>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).</p>
  
  <p>This Question is similar to <a href="https://stackoverflow.com/q/1822549/642706">this Question</a> but updated for Swift and the modern macOS and Java 8.</p>