10

I am responsible for a Java application which is deployed on multiple platforms including OS X. With recent versions of the application we distribute two separate bundles for OS X - one which uses the JavaApplicationStub provided by Apple, and another one which includes a bundled JDK 7 and uses a launcher produced in-house (a modification of Oracle's JavaAppLauncher).

The issue is, with the latter bundle, Mac OS X still insists on you having Java 6 installed if you try to run the application. Specifically the message says:

"To open (application), you need a Java SE 6 runtime. Would you like to install one now?"

If you don't install Java SE 6, you are unable to run the application, despite the fact that JDK 7 is bundled (and, if you do install Java 6, it nevertheless runs with the bundled Java 7).

What I'm struggling to figure out is how OS X decides that the application requires Java? I've tried renaming the 'Java' dictionary in the Info.plist file, and renaming the Java subfolder within the Resources folder, without success. Does anyone have any ideas? Surely it's possible to have an application with a bundled JDK run without requiring a system JDK to be installed?

davmac
  • 20,150
  • 1
  • 40
  • 68
  • does [this](http://stackoverflow.com/questions/14806709/application-is-using-java-6-from-apple-instead-of-java-7-from-oracle-on-mac-os-x) help in any way? – Fritz May 16 '13 at 15:48
  • *"another one which includes a bundled JDK 7"* DYM JRE 7? – Andrew Thompson May 16 '13 at 15:53
  • Gamb, no. We are not using the JavaAppLauncher from Apple. The problem is not that it's running with the wrong JDK, but that it is insisting that Java 6 be installed. – davmac May 16 '13 at 15:53
  • Andrew Thompson, I mean JDK. – davmac May 16 '13 at 15:54
  • searching yields - http://stackoverflow.com/questions/14105575/eclipse-on-mac-10-8-installed-1-7-0-jre-jdk-but-eclipse-wont-launch - it looks like you need a symlink on the system to prevent the prompt? – Anya Shenanigans May 16 '13 at 16:00
  • Petesh, thanks, that's better than nothing, although I'm still hoping for a solution that doesn't require asking the users to open a terminal. – davmac May 16 '13 at 16:11

1 Answers1

2

I've found the answer (with help from Mike Swingler on the macosx-port-dev@openjdk.java.net mailing list).

The presence of the 'Java' dictionary in the Info.plist file is what triggers the dialog, however, changing the name of the dictionary after trying to start the app isn't good enough. The system somehow caches the requirement for Java and so simply issues the dialog again. To avoid this it was necessary to download a fresh copy of the application and make the change before trying to run it for the first time (I'm told since that renaming the app would suffice, even renaming it and then again back to the original name).

Fortunately, this means that all we have to do is change the name of the 'Java' dictionary, and alter our customised launcher so that it uses the new dictionary name.

davmac
  • 20,150
  • 1
  • 40
  • 68