Getting OS X to Install Java 7 on App Launch

Christopher Brown christopherbrown06 at
Thu Feb 6 00:31:09 PST 2014


One Swing application that I am maintaining currently relies on the Apple
JavaApplicationStub.  Reading this thread, I'm wondering if I should look
at or look somewhere else
(is it deprecated by the JavaFX packager)?

With the upgrade of a Swing application away from Java6, I still need to
maintain use of the Apple extensions for naming the application menu,
integrating with the "Quit" and "Preferences" menu, dock and so on.  The
JavaApplicationStub approach is fine, because I don't want to embed a JRE
(download size *IS* perceived as an issue by some, as is the waste of disk
space, when there are lots of similar applications) and because there's no
need for JavaFX.  I'd appreciate any feedback from anyone about how to
achieve this so I can concentrate on the best approach instead of wasting
time on dead ends...

I've already updated a SWT application using a simple shell script relying
on /usr/libexec/java_home in an ".app" because it integrates nicely with
the OS X desktop with none of the Swing "it's how you launch it" issues.
It deals with the "there's no JRE" issue by detecting the problem in the
script and displaying a dialog using AppleScript.


On 6 February 2014 05:38, Scott Palmer <swpalmer at> wrote:

> As you seem to be aware, with Java 7 and later you are expected to embed
> the JRE in your application bundle.  I think the JavaFX packager will do
> this for you.  The size is usually not relevant these days and the added
> reliability makes up for it anyway. You leave no room for the user to
> download the wrong version or to introduce a bug by downloading a later
> version that you haven't tested with.
> However, if you wish for the user to use a shared instance of Java 7, you
> should probably use Java Web Start or an Applet to deliver your
> application.  I believe the java packaging tools will generate some
> JavaScript that will help get the shared JRE installed.
> Scott
> > On Feb 5, 2014, at 11:04 PM, Will Herrmann <wjherrmann at> wrote:
> >
> > Java is no longer installed by default on OS X, but fortunately if a
> user tries to launch a Java app for the first time, they receive the
> following message: "To open "Test App", you need a Java SE 6 Runtime. Would
> you like to install one now?"
> >
> > However, this prompts to install Java SE 6 rather than Java SE 7, which
> has been out for some time. This even happens on OS 10.9.1. I'm considering
> making my app require Java SE 7, but I want to ensure that users will be
> downloading the proper version (I'm aware I can bundle the JRE, but I would
> prefer not to add it since it would quadruple the app size). Ideally, I'd
> like for the dialog box shown above to continue to be shown, but instead of
> downloading Java SE 6, it downloads Java SE 7.
> >
> > I tried changing the JVMVersion key in the Info.plist file of my
> application to 1.7+, but that didn't make any difference and it still
> prompted to download Java SE 6 (which if it actually did require it, would
> result in the user being unable to install the app).
> >
> > Is there a way that I can make this dialog prompt to install Java 7?
> >
> > I originally posted this on Stack Overflow at
>, but didn't receive a reply
> and it was suggested I try this mailing list. Feel free to respond either
> here or there.
> >
> > Thanks in Advance,
> > -Will Herrmann

More information about the macosx-port-dev mailing list