How to Run Executable Java (.jar) Files in Windows 10 (Easy)

If for some reason you are unable to run your Java programs in Windows by double-clicking the jar file, oftentimes is either you don’t have the Java Development Kit (JDK) installed on your PC or you haven’t created the right association for the execution path of the java files, in other words, you haven’t set Java as the default program for opening your .jar files.

As such, when you try to run your java files, you get a very brief pop up of the dark command prompt terminal which will disappear almost immediately without opening your expected Java program. If you don’t have the JDK entirely, then nothing will happen at all when you double-click.

Usually in this situation, your Java files will not look like a regular java file as shown in the image below, it might look just like some WinRAR file if you have WinRAR or some other archive software installed on your computer. In such a situation, when you right-click and select properties, you will see from the type of file that is actually a java file with .jar extension.

However, when you double-click on it, it opens up in WinRAR which is not what you want.

Now, even after fixing the problem of opening up with WinRAR which is the first stage of this fix, you would likely run into the next problem described above, which is having the dark command terminal pop up and disappear immediately.

Buy Cheap Genuine Windows 10 Pro License Key (Lifetime Activation)

 

So even though your .jar file now looks like an actual Java file, when you double-click on it, either nothing happens or you get a flash of the DOS command terminal. There are several possible ways to resolve this issue, some demand more technical skills than others, below is a two-stage process I discovered that can easily resolve this issue without the need for deep technical skills.

With this solution, there’s no need to tweak your registry or run some complex commands, making it convenient for a typical everyday user who’s just getting started with programming and doesn’t yet have the competence to make the registry tweaks and run all the commands. More so, if you just want to quickly run your .jar file without making many modifications to your system configuration, then this could be a go-to solution for you.

STAGE 1: Installing JDK/JRE to resolve the file format issue

So, first is the WinRAR issue, now if you don’t have WinRAR installed on your computer, then yours might look different, maybe a plain file icon like in the image below:

In any case, the issue is usually one of two things, either you don’t have the Java Development Kit installed on your PC or you haven’t set it as the default program for opening your .jar files.

Here I should mention that I already have Java Runtime Environment installed on this laptop, so is technically possible to run the jar file without installing the JDK but the JDK makes it more convenient and more user-friendly. And if you’re wondering the difference between JDK and the JRE, the JDK basically contains everything that is in the JRE together with other tools like the compilers and debuggers which makes running such jar files more convenient.

So for the case of not having JDK installed, you can simply go to oracle.com and download the latest JDK that corresponds with your system specifications. After downloading simply install with default configurations, and then you will be good to go.

Buy Cheap Genuine Microsoft Office Pro Plus 2019 (Premium Licenses)

To get you .jar file looking like a Java file and opening with java by default, first open your file explorer, click on the View tab and go to where it says options, click on the drop-down and select change folder and search options.

A dialog box like this should pop up, here click on the view tab and search for where it says “Hide extensions for known file types” and uncheck it, then apply and hit ok.

Now if you go back to your Java file, you will see that it now has the .jar extension added to the file name, but still, it doesn’t look like a java file and would still open with WinRAR if I double click on it.

Recover All Deleted Files, 100% Safe, Trusted By Millions‎ (For Windows)

To get this file looking like a java file and opening with java by default, simply right click on the jar file and select open with, then click on choose another app.

Here select Java Platform SE Binary, the check the box where it says always use this app to open .jar file.

Then you should have your jar file looking like a Java file and ready to run, this also helps you to identify your java file from a bunch of other files.

But still, when you double-click on your Java file, nothing happens, which brings us to the second issue of nothing happening when you double-click on your jar file.

Buy Cheap Genuine Windows 10 Home License Key (Lifetime Activation)

STAGE 2: Creating the right association for executing the Java files

To fix the issue of nothing happening when you double-click your .jar file or having the DOS terminal pop up and disappear without launching your expected Java program. Go to where you have your java file saved, I have mine on the desktop, right-click on an empty space and go to new and then text document.

You can name your text file to whatever you like, I will name mine run.

Next, change the file extension from .txt to .bat, hit yes on the dialog box, and then you should have a file looking like this.

Now right-click on the bat file and select edit.

It should open up a blank notepad like this, here type in “java -jar ” and then the name of your jar file including the .jar extension as shown in the image below.

It is best to copy-paste is you have a long file name because this won’t work for you if the file name is not exactly the same including the .jar extension, then save and close the file.

Now, whenever you double-click on this bat file it should open up your java application.

Buy Cheap Genuine Windows 10 Pro License Key (Lifetime Activation)

Hope this was able to help you out. If you have any questions regarding the procedures, please post in the comment section to get more help. The video below demonstrates most of the suggestions discussed above.

Below are other posts that might interest you.