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 runtimeTo 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?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?