When double clicking a .jar file a cmd window opens briefly and then disappears, but the .jar file isn't executed

11,561

.jars are not executable files. To execute a jar, open a terminal (by Start -> Run - > type cmd (ENTER) -> cd <path-where-jar-is>) and run:

java -jar <filename.jar>

No jar can execute (in Windows) by double clicking. If you want to achieve the "double clicking" effect, you will need to create a .bat or .cmd file (that is executable).

Share:
11,561
user1068367
Author by

user1068367

Updated on September 18, 2022

Comments

  • user1068367
    user1068367 almost 2 years

    I am looking for a solution to the problem posed in the title. When I double click a .jar file, or right click and open, it simply opens a black cmd window for a split second, then closes it, and nothing else happens. I know that the programs do not run, as a few that I have tried are installers, yet the program they are meant to install are nowhere to be found. Is there a way to fix this so that the files actually function?

  • Mathew Lionnet
    Mathew Lionnet almost 5 years
    Normally the JAR extension is registered to be executed.
  • DeemV
    DeemV almost 5 years
    Keep in mind that jar extensions and files are userd to deliver malicious payloads...so, there is a slight possibility jar files are blocked by means of corporate secur policy, antivirus etc.