JAR files are like EXE files except that they need a Java framework to run. Imagine them as EXE files on Windows which you can double click to launch the program. When you run an EXE file, it uses Windows OS support. Similarly, when you run JAR files, you need the help of Java Framework to open. When we say open JAR file, we are not opening the file like an archive file, but we are executing it. In this post, I will share how to open or run a JAR file on Windows 10.
While Archiver tools like 7-Zip can extract content from JAR files, but doing that is pointless – we need to execute the files just as we run the EXE files.
How to run a JAR file in Windows 10
Since Java files can’t run on Windows on its own, you need to install the Java Framework or what is popularly called as Java. That said, Java files can be dependent on a particular version of Java. You will need to take care of that as well.
- Download and install Java.
- Set System path
- Run the JAVA file
- Set Java file association.
1] Download and install Java Framework
To run a JAR file on Windows, you need to install Java on your system. Go to Java Download Page, and install it. The default will install the latest version only. However, if your JAR file needs a different version of Java, you can download it from here.
Sometimes, an existing older version of Java can cause an issue. So, if you are facing such a problem, make sure to remove the older version first. Use the official Java Remover tool to get rid of it. Then install the latest version.
2] Set System Path for Java
Next, you need to set the JAVA_HOME path. It makes sure that any JAVA file you run can find the necessary libraries for the program. You can also use the command line to echo the Java path to figure out if it is correct.
3] Run a Java or JAR file
Now when you double click on the JAR file, it will automatically run like how EXE files execute. If there is a problem with version, the file should inform you.
If you have a JAR file which is not running on its own, then you can use java JDK to run it. Open Command Prompt, and type java -jar name_of_jar_file.jar. It will execute the JAR file automatically.
4] Set the Java or JAR file association
The last step is to establish a file association with Java run time. It will make sure that every time you run, you are not asked to select a program which can execute it.
Shift + Right-click on the file, and select Open with option.
Select ‘Choose another app.’
If Java(TM) Platform SE binary is not in your list, scroll, and then click on More Apps.
And then choose Select app from the computer.
You should see ‘Java(TM) Platform SE binary’ listed in this context menu but don’t select it.
Locate the file which can run the JAVA or JAR file which is available in the path we suggested above.
Make sure to check the box which says, “Always use this program.”
Once done, all future JAR files will automatically open with Java run time library. You should see the Java icon for all of these files.
Talkpoints hope these tips where easy to understand, and were of help to open or run a Java file on Windows