For a while, I had trouble running jar files on my Mac. I made sure I had both JRE and JDK installed, but I would still get the following error message:
Java application launch failed. Check Console for possible error messages related to "/Users/user/Downloads/program.jar".
Recently, I come across a Reddit post that suggested changing some privacy settings, but it didn’t mention which settings to change, so I looked into it and found the security and privacy settings that blocked my Java applications from running.
To run a jar file on Mac, go to
System Preferences > Security & Privacy > Privacy. On the left menu, scroll down until you see
Files and Folders. Click on
Files and Folders to see the text “Allow the apps to access files and folders.” Make sure the Downloads Folder, Documents Folder, and Desktop Folder under java are checked.
Click the lock to make changes.
If your issue was caused by the same reason, you should now be able to launch a jar application by clicking on the jar file.
Alternatively, you can launch a Java application using the command line.
java -jar path/application.jar
Update: I am using macOS Big Sur version 11.2.2, if it helps.
Let me know in the comments if this helped.