Jar file does nothing after double click

1k Views Asked by At

I have made a java swing program and created an executable jar file via jar cfm Game.jar MANIFEST.MF *.class in terminal. When I try to run the jar file through terminal, it works fine. But when I try to run the file by double clicking the icon, nothing happens. MANIFEST.MF:

    Manifest-Version: 1.0
    Main-Class: Game

I have mac os 10.6 and the default app to open jar files is jar launcher.

1

There are 1 best solutions below

1
jazzwhistle On

Terminal and Finder don't necessarily use the same version of Java:

"When starting a Java application through the command line, the system uses the default JDK. It is possible for the version of the JRE to be different from the default version of the JDK"

https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-macos.htm#JSJIG-GUID-C5F0BF25-3487-4F33-9275-7000C8E1C58C