2

In short: On a mac with a clean installation of Yosemite, doubleclicking a compiled Java mac-style .app application bundle fails to launch the app, unless Apple's Java 6 is installed, even if the current version of Java for the Mac from Oracle is installed.

At length: When Apple developed the Java SDK for macosx, you could open a .app mac-style application bundle written in Java by doubleclicking its icon in Finder, its app icon will show up in your dock while it was running, and its menu items would live in the Mac OS menu bar. Java apps behaved almost like native Mac apps.

On the other hand, if you install the current Java SDK from Oracle, you can execute your Java application with java -jar YourApp.app/Contents/Resources/Java/yourapp.jar, but you get a generic dock icon, your menu items live on top of the window instead of menu bar.

And if you don't have Java 6 from Apple installed on the machine, which is not included in recent versions of the OS but still available for download from Apple at this location (but it's pretty out of date at this point), then you just get an error message dialogue: "To open YourApp.app you need to install the legacy Java SE 6 runtime." with a link to Apple's outdated implementation, even though you already have Oracle's Java 8 installed already.

On a Mac with Java 8 from Oracle installed, but not Java 6 from Apple, is there a way to open a Java app from finder, or retain these other native platform compatibilities? Is there a way to force a .app bundle to use your preferred Java installation?

I'm basically asking the same question as To open “Eclipse” you need to install the legacy Java SE 6 runtime. Is there a solution to this problem other than installing legacy Java 6?

Also this question may be relevant: Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X?

At the questions Run java bundled in .app from command-line and Why is Java SE 6 Legacy required to open Intellij?, it is suggested that you can force your Java .app bundle to use a newer version of Java if you change the JVMVersion in YourApp.app/Contents/Info.plist, but this did not work for me. Those answers are from Java 1.7 era, maybe it's outdated?

1

From replies to a question I asked on Apple's java-dev list it would appear that on a Mac with Java 8 from Oracle installed, but not Java 6 from Apple, there is no current way to open a Java application bundle that was created using Apple's own old jar bundler technology. I suspect this is because the JavaApplicationStub is written to expect some aspect of Apple's Java not present in Oracle's Java.

From a user's point of view the only thing to do would seem to be to download and install Java 6 from https://support.apple.com/kb/DL1572 while it is still available.

From a developer's point of view the safest bet would be to embed Java within one's application bundle using a tool such as jwrapper (www.jwrapper.com). Alternatively there may be tools for creating a bundle that will run with Oracle's Java 8+.

  • I'm talking about a .app mac-style application bundle, not a jar-file. I have edited the question to make that clearer. – ziggurism Apr 17 '15 at 19:27
  • I've edited my answer. I don't think your question is the same as needing Java 6 to run Eclipse on Yosemite becaue I don't so I have ignored that (although it may possibly be true for an old version of Eclipse). Anyway I'll have a look at that question separately. – David Apr 17 '15 at 22:47
  • Structure Motivator does not work on my Mac. Like all java apps, it gives me an error message asking for Java 6. Screengrab here: imgur.com/T1xrpoX. The jar file inside the .app bundle as well as the Unix jar file both ran fine on my machine via Jar launcher. – ziggurism Apr 17 '15 at 23:14
  • It's a Macbook pro running Yosemite 10.10.3. It has Java JDK 1.8 update 45 installed, but never Java 6 from Apple, which seems to be the only version that allows doubleclicking. I have same problem on other Macs, whether new or upgrades from pre-Yosemite. Are you sure you don't have Apple's Java 6 installed? – ziggurism Apr 17 '15 at 23:15
  • Comment for anyone else: Doubleclicking the jar file will not actually run the Java app via Jar launcher, since it is not signed. you have to right-click and choose "open" from the contextual menu to bypass Gatekeeper. Presumably also applies to the .app bundle, if you have a version of Java that will run it. – ziggurism Apr 17 '15 at 23:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .