I have an OS X objective-c app which programmatically invokes the Java command to run a Java program.
If I'm correct, Java is no longer installed by default on OS X. I want to ship my app and not force users to download Java before they can use the app.
How can I ship a copy of the java executable along with the runtime (rt.jar
). Of course I can copy rt.jar
in the app bundle of course but what about the java binary? Can I just copy this as well?
I think in your case, the best option would be to include the Java Installer Kernel (small install that downloads and installs the latest version of Java, if necessary).
The main problem with bundling the binaries per-se in your app is basically, security. Vulnerabilities are discovered routinely in the JRE and patched. If you bundle an specific version and a vulnerability is discovered after your release, you will be basically weakening the security of the machines where your application is installed. As you obviously don't want to do that, it is better to try to include logic to detect if a compatible version is present, or otherwise properly install the right version. Many installer packages include options like this: For example, OpenOffice/LibreOffice are native apps but they require Java to be present, and they use a similar installation method as the one described above.
Each self-contained application package includes the following items:
Application code, packaged into a set of JAR files, plus any other application resources (data files, native libraries)
Copy of the JRE, to be used by this application only
Native launcher for the application, multiple launchers for a single package are supported
Metadata, such as icons
Multiple package formats are possible. Built-in support is provided for several types of packages. You can also assemble your own packages by post-processing a self-contained application packaged as a folder, for example if you want to distribute your application as a ZIP file.
--
Self-contained application packages have the following drawbacks:
"Download and run" user experience
Unlike web deployment, the user experience is not about "launch the application from the web." It is more one of "download, install, and run" process, in which the user might need to go through additional steps to get the application launched. For example, the user might have to accept a browser or operating system security dialog, or find and launch the application installer from the download folder.
Larger download size
In general, the size of self-contained application packages is larger than the size of a standalone application, because a private copy of the JRE is included.
Package per target platform
Self-contained application packages are platform-specific and can only be produced for the same system on which you build. To deliver self-contained application packages on Windows, Linux, and OS X, you must build your project on all three platforms.
Application updates are the responsibility of developer
Web-deployed Java applications automatically download application updates from the web as soon as they are available. The Java Autoupdate mechanism takes care of updating the JRE to the latest secure version several times every year. Self-contained applications do not have built-in support for automatic updates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With