installer
installer copied to clipboard
Double-click on JAR doesn't launch the application - Mac OS X
Issues 32 and 34 were merged and closed. Those issues were for Windows. The same issue is true for MAC OS X. For Oracle JDK created JAR files, they are launched with "jar launcher.app" (15.0.1) found at /System/Library/CoreServices/Jar Launcher.app. Minor inconvenience, but a difference. I have found this with all AdoptOpenJDK releases on Mac OS X 10.14 and 10.13.
@todivefor any idea how this would be associated?
So I've created a .jar file on my mac and when I double click it, it opens with jar launcher app. That seems to be working for me.
Or is this to do with making jar launcher.app use adoptopenjdk Java rather than another vendor?
running a test build with this fix: https://github.com/AdoptOpenJDK/openjdk-installer/pull/95
@todivefor could you please confirm the fix for me by running the following commands making sure that the INPUT_DIRECTORY variable is set correctly:
INPUT_DIRECTORY=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk
/usr/libexec/PlistBuddy -c "Add :JavaVM:JVMCapabilities:1 string JNI" "${INPUT_DIRECTORY}/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Add :JavaVM:JVMCapabilities:2 string BundledApp" "${INPUT_DIRECTORY}/Contents/Info.plist"
@gdams that did not work. I first tried it just like you said and it seemed to work. I then tried it on INPUT_DIRECTORY=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk and it did not work there. I went back to adoptopenjdk-8.jdk and removed the above fix and re-tryed. It worked, so my statement all AdoptOpenJDK releases was false. Double click on 1.8.0_192-b12 works, but 11.0.3+7 does not.
hmmm okay, do you know if an Oracle Java 11 works with this?
I do not, but I can give it a try.
I tried this on Oracle Java 11, and the bottom line is it operates the same as AdoptOpenJDK 11 (cannot double click jar). I can get both Oracle 11 and AdoptOpenJDK 11 to work if within Netbeans if I have Java Platform set to JDK 11 and Source/Binary Format set to JDK 8. I don't understand this and posted this question on Superuser:
https://superuser.com/questions/1429769/netbeans-java-platform-and-source-binary-format-inconsistency
Thanks for your help. I'm thinking that I should probably land the change anyway to be consistent with Oracle and then we can do some further investigation.
I don't know if this actually helps the issue, but one solution would be to create an extremely simple application in Automator that runs shell script java -jar "$@"
when fed a jar file.
You can then just use Get Info on any given jar to set this app as the default for opening jar files (the only side-effect of this is that the icons on jar files themselves will change, but if you don't mind that, this is a pretty good solution).
Here's a screenshot of the actual project in Automator:
EDIT: If you don't want this file to just clutter up your Desktop or anything, you can place it in ~/Library/Services/, as that is typically where Automator apps go.
Something changed going from 11.0.8_10 to 11.0.9.1_1 and continues into 11.0.10_9. I have a jar file that I double click and worked until 11.0.9.1_1. I started getting that the jar file needed to be installed in and run from the user's home directory. I just went back to 11.0.8_10. Now I installed 11.0.10_9 and got the same. I guess "jar launcher.app" executed from the directory in which it resided, but now does not. I can execute java -jar xxxxx.jar from within the directory, but double click does not. This is not a big deal, I can work around, just a change.
@todivefor could you please confirm the fix for me by running the following commands making sure that the INPUT_DIRECTORY variable is set correctly:
INPUT_DIRECTORY=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk /usr/libexec/PlistBuddy -c "Add :JavaVM:JVMCapabilities:1 string JNI" "${INPUT_DIRECTORY}/Contents/Info.plist" /usr/libexec/PlistBuddy -c "Add :JavaVM:JVMCapabilities:2 string BundledApp" "${INPUT_DIRECTORY}/Contents/Info.plist"
Hey.
I had this same issue, came across this issues thread. Fresh install of Mac OS Big Sur with Adopt Open JDK 11.
$ java -version openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
I adjusted INPUT_DIRECTORY. I can now launch .jar files with the stock JavaLauncher.app without issue.
@jwrb what did you adjust INPUT_DIRECTORY to be? Can you also send me your Info.plist
@jwrb I would be glad to test. How do I change INPUT_DIRECTORY?
@jwrb Nevermind
Ran:
PWRMacbookPro:~ userid$ INPUT_DIRECTORY=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk PWRMacbookPro:~ userid$ /usr/libexec/PlistBuddy -c "Add :JavaVM:JVMCapabilities:1 string JNI" "${INPUT_DIRECTORY}/Contents/Info.plist" PWRMacbookPro:~ userid$ /usr/libexec/PlistBuddy -c "Add :JavaVM:JVMCapabilities:2 string BundledApp" "${INPUT_DIRECTORY}/Contents/Info.plist" PWRMacbookPro:~ userid$
Got same result.