0

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?

1

.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).

1
  • Normally the JAR extension is registered to be executed.
    – eckes
    Jul 28 '19 at 18:44
0

If no application shows up it is possible that the JAR file is not executable (has no main class defined) or that it has no GUI (only console output) or that it has a startup error (maybe even need more files on the classpath).

In all cases you find out more information about the actual problem if you start a command line console and execute the jar file with either

"C:\Program Files\java\jre-8\bin\java.exe" -jar file.jar

In the directory where the JAR file is stored. Of course you need to adjust the Java location to your actual location.

You can also try what happens when you „simulate“ the starting of the file:

start file.jar

BTW the .jar Extension is normally registered to be opened by java to be executed. You see this in the explorer when it tells you the file type is a „Executable JAR file“. However it can happen that this association is corrupt or changed. In that case most often reinstalling JRE helps, or you manually have to clean out all other JAR associations.

1
  • 1
    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.
    – DeemV
    Jul 29 '19 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.