- How to Run JAR Files on Windows 10 — 4 Ways [MiniTool Tips]
- What Are JAR Files?
- How to Run JAR Files on Windows 10?
- Way 1. Add Java to Windows
- Way 2. Open JAR Files with JAVA Platform SE Binary
- Way 3. Open JAR Files with Command Prompt
- Way 4. Add a Third-Party JAR Executor
- Final Words
- About The Author
- How to Run .JAR Files on Windows 10
- Running JAR-Packaged Software
- Applets Packaged in JAR Files
- JAR Files as Applications
- How to open or run a JAR file on Windows 11/10
- What is Java executable JAR file?
- How to run a JAR file in Windows 11/10
- 1] Download and install Java Framework
- 2] Set System Path for Java
- 3] Run a Java or JAR file
- 4] Set the Java or JAR file association
- How run Java JAR from command line?
How to Run JAR Files on Windows 10 — 4 Ways [MiniTool Tips]
JAR files are commonly used on Windows computers. Hence, do you know how to run .JAR files on Windows 10? This post from MiniTool shows how to run JAR files on Windows 10. In addition, you can visit MiniTool to find more Windows tips and solutions.
What Are JAR Files?
A JAR is a package file format typically used to aggregate many Java class files and associated metadata and resources, such as text, images,etc. into one file for distribution. JAR files are archive files that include a Java-specified manifest file. They are built on the ZIP format and typically have a .jar file extension.
However, do you know how to run .JAR files on Windows 10? If no, keep on your reading, and the following part will show you how to run JAR files.
How to Run JAR Files on Windows 10?
In this part, we will show you how to run .JAR files with several different ways.
Way 1. Add Java to Windows
The first way you can try to open JAR files is to add Java to Windows. Without it, Java apps will not run on Windows and the JAR files also will not be opened.
So, in order to run .JAR files, you need to add JAVA to Windows. Now, here is the tutorial.
- Open Command Prompt.
- Next, type java -version in the Command Line window and hit Enter to continue. It will show you the further details of Java version on your computer.
- If there is no Java on your computer, click here to download the latest one.
- Then run it on your computer.
After all steps are finished, you can run .JAR files through the JAVA app.
Way 2. Open JAR Files with JAVA Platform SE Binary
In order to run JAR files, you can also choose to run it through the JAVA Platform SE Binary.
- Right-click the JAR file and select Open with from the context menu.
- Then select Choose another app and then select it to open with Java Platform SE binary.
- Check the option Always use this app to open Jar files.
- Then press OK to continue.
After all steps are finished, you can open JAR files on Windows 10 through the JAVA Platform SE binary.
Way 3. Open JAR Files with Command Prompt
Besides the above method, you can also run .JAR files through the Command Prompt.
- Open Command Prompt as administrator.
- Type the command – java –jar c:\path\to\jar\file.jar in the Command Line window and hit Enter to continue. Please replace the c:\path\to\jar\file.jar with the actual path and file title of the JAR you need to run in Windows.
Then, it will open the executable JAR file so long as it contains manifest file to specify the applications entry point.
Way 4. Add a Third-Party JAR Executor
As for how to run JAR files, you can use the third-party JAR executor and there are various JAR executors on the market. So, in order to run the JAR file, you can download a third-party JAR executor. After that, you can open the JAR file successfully.
Final Words
To sum up, as for how to run.JAR files, this post has introduced 4 ways. So, if you want to run .Jar files on Windows 10, you can try these ways. If you have any better idea to run .JAR files, you can share it in the comment zone.
About The Author
Tina is a technology enthusiast and joined MiniTool in 2018. As an editor of MiniTool, she is keeping on sharing computer tips and providing reliable solutions, especially specializing in Windows and files backup and restore. Besides, she is expanding her knowledge and skills in data recovery, disk space optimizations, etc. On her spare time, Tina likes to watch movies, go shopping or chat with friends and enjoy her life.
How to Run .JAR Files on Windows 10
If you find yourself unable to open .jar files on Windows 10, it is likely due to one of the following problems:
*The Java Run-Time Environment is not properly set to run .jar files
*Windows Registry is not calling JRE (Java Runtime Environment) properly
Luckily there are a couple of easy solutions for fixing this. What happens for most people is that when trying to open a .jar file, Windows will typically ask what program you want to use to run the program. Of course, most people would simply choose the Java.exe, but this has the problem of stripping –jar from the program’s execution path. Basically you cannot set the required complex command to open .jar files by using “Open With…” in Windows 10.
So what will normally happen is that you’ll associate the .jar file to open with java.exe, you double-click on the executable .jar, and a command prompt window will open for a split second and close, and the program does not launch.
What we need to do is re-associate the .jar file with the Java binary.
- Make sure you are updated with the latest Java Runtime Environment.
- Navigate to your Java installation folder, go inside the /bin/ folder, right-click on Java.exe and set it to “Run as Administrator”.
- Press Windows + X keys and select “Command Prompt (Admin)” or Powershell (Admin) and type cmd
- Type the following commands into the prompt (replace the C:\Program Files\etc with your actual Java installation folder, for example, C:\Program Files (x86)\Java\jre1.8.0_131\bin\java.exe):
ftype jarfileterm=cmd /s /k “”C:\Program Files\Java\jre7\bin\java.exe” -jar “%1″ %*”
assoc .jar=jarfileterm
Or if you want the command prompt to stay open after launching the .jar file (for debugging purposes)
ftype jarfileterm=cmd /s /k “”C:\Program Files\Java\jre7\bin\java.exe” -jar “%1″ %*”
assoc .jar=jarfileterm
Now try to launch the .jar file. Depending on which of the steps above you took, the java executable should either launch or launch with a persistent command prompt behind it (which will fill up with Java calls from the app, useful for debugging purposes).
However, if the steps did not work, we will need to tweak your registry.
- Right-click on your Start button and do a search for “regedit”, then open it.
- Now expand the HKEY_CLASSES_ROOT folder, and scroll down until you find the folders “jar_auto_file” and “jarfileterm”.
- Expand to the following path
jar_auto_file > Shell > Open > Command
Running JAR-Packaged Software
Now that you have learned how to create JAR files, how do you actually run the code you packaged? Consider these scenarios:
- Your JAR file contains an applet that is to be run inside a browser.
- Your JAR file contains an application that is to be started from the command line.
- Your JAR file contains code that you want to use as an extension.
This section will cover the first two situations. A separate trail in the tutorial on the extension mechanism covers the use of JAR files as extensions.
Applets Packaged in JAR Files
To start any applet from an HTML file for running inside a browser, you use the applet tag. For more information, see the Java Applets lesson. If the applet is bundled as a JAR file, the only thing you need to do differently is to use the archive parameter to specify the relative path to the JAR file.
As an example, use the TicTacToe demo applet. The applet tag in the HTML file that displays the applet can be marked up like this:
If the TicTacToe demo was packaged in a JAR file named TicTacToe.jar, you can modify the applet tag with the addition of an archive parameter:
The archive parameter specifies the relative path to the JAR file that contains TicTacToe.class. For this example it is assumed that the JAR file and the HTML file are in the same directory. If they are not, you must include the JAR file’s relative path in the archive parameter’s value. For example, if the JAR file was one directory below the HTML file in a directory called applets, the applet tag would look like this:
JAR Files as Applications
You can run JAR packaged applications with the Java launcher (java command). The basic command is:
The -jar flag tells the launcher that the application is packaged in the JAR file format. You can only specify one JAR file, which must contain all of the application-specific code.
Before you execute this command, make sure that the runtime environment has information about which class within the JAR file is the application’s entry point.
To indicate which class is the application’s entry point, you must add a Main-Class header to the JAR file’s manifest. The header takes the form:
The header’s value, classname, is the name of the class that is the application’s entry point.
For more information, see the Setting an Application’s Entry Point section.
When the Main-Class is set in the manifest file, you can run the application from the command line:
To run the application from the JAR file that is in another directory, you must specify the path of that directory: java -jar path/app.jar
How to open or run a JAR file on Windows 11/10
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 JAVA or JAR files, you need the help of Java Framework to open them. 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 11/10.
What is Java executable JAR file?
A JAR file is an archiving format that not only stores directories and source files and can also be run as executable files. Such Java ARchive files can contain Java class files that will run when the JAR is executed.
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 11/10
- Download and install Java.
- Set the System path
- Run the JAVA file
- Set Java file association
- Establish a file association with Java runtime.
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 ensures 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 determine 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
- 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.
How run Java JAR from command line?
You’ll need to use the java command to run a .jar file
If you don’t have java installed, you can fix that by installing the default-jre package.
We hope these tips were easy to understand and were of help to open or run a Java file on Windows 11/10.