I wrote a small Java desktop application using NetBeans, Java 8 and JavaFX 8 on my MacBook running macOS High Sierra. I can launch it from Terminal by executing a Bash script (mentioned below), but double clicking on the JAR in Finder fails (right clicking and selecting Open fails too) and I receive a suggestion that I look for errors in Console.app, but get no other clue as to what's failing. It's a very specialized app that I'll probably only distribute to a couple of co-workers who don't work in Terminal.
Google search has given me solutions that are out of date, the Oracle solution (out of date) provided a link that proved useless.
What do I need to do to be able make the JAR file executable from Finder? How can I get more information on what's wrong? Since it's not signed it might be that Gatekeeper is the culprit.
My script is in
~/bin which is included in PATH. I have a folder,
~/jars for Java apps, each of which has its own folder. In that folder I have copied my project-> ... dist app.jar and my libs folder that has external jar libraries. The script has execute permissions. Here is the script:
#!/bin/bash java -jar $HOME/jars/myApp/myApp.
I can launch the app from Terminal or from Finder but the first time finder will think I want to edit it so I must choose Other and then choose Terminal. BTW it works exactly the same in Ubuntu, I just copied the script, dropped it into
~/bin, and dropped the
myApp folder in
~/jars. It mostly ran but the JRE on the Ubuntu machine, while Java 8, is a little older version than the one on my Mac and I get a run time error after a while. I think that updating to the same version will solve the problem as I don't know how to force NetBeans to include the JRE.