I created a .jar that requires Java 7. I have Java 7 (JDK and JRE) and I can double-click to run the .jar. However, I want to package this into an application.
What
You are definitely right with your assumption that Apples JavaApplicationStub
located here:
System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub
is only compatible with Apples own Java Packages build for Mac OS X.
Apple is discontinuing their own Java System Packages and only supports Java 6 in their fade out process. Oracle took now over and provides Java 7 for Mac OS X from 10.7.3 on. Apple is even discontinuing developer tools like Jar Bundler.app
without any notice, as you can see in this post:
Some people even tried desperately to manually increase the JVMVersion
property value in Info.plist
, read by Apples JavaApplicationStub
, from a documented literal 1.6
or 1.6+
to an undocumented literal like 1.7
. This won't work either and you will end up with a dialog like this, even if you have installed Oracles Java 7 Package.
So it is likely you will find other inconstancies between the retired Apple Java 6 world and the future Oracle Java 7 world.
To build an application packages based on Oracles Java 7 you need to use Oracles AppBundler Ant Task containing Oracles JavaAppLauncher. This one now only supports Oracles Java 7 for Mac OS X and isn't backwards compatible with Apples own Java System Packages.
The good news now is, you can inline Oracles Java 7 JRE into your application package. It will be contained within the directory
Contents/PlugIns
in the application package, for example
Contents/PlugIns/jdk1.7.0_17.jdk
This means your application package is totally self contained and ready for App Store deployment.
But you don't have to do that. You could also rely on the installed Oracle Java 7 Package.
For a more detailed answer you should also checkout: