JAR File Not Opening On Windows? Here’s How To Fix It.
JAR recordsdata, additionally referred to as Java Archives recordsdata, are archives of Java class recordsdata. In a nutshell, JAR recordsdata are teams of recordsdata that may comprise images, audio, visuals, and many others., and may run as a single executable program when paired with the Java Runtime Environment.
They are predominantly utilized by Java builders for coding and programming. However, jar recordsdata refusing to open is among the many points that may occur whereas using them.
Why Does My JAR File Not Open?
Here are the doable causes in your jar file refusing to open.
JAR file set to open with different purposes.
Java Runtime Environment having points.
Incompatible JRE or JDK model
Incorrect Filename Extension
How to Fix JAR File Not Opening?
There are a number of strategies you should use to repair JAR recordsdata not opening. However, earlier than you start, make sure the JAR file has the proper filename extension. To achieve this, go to the View tab and allow File identify extensions. Make positive the JAR file has .jar on the finish.
Make your manner down the record of fixes to see which one works for you.
Set JRE as Default for JAR recordsdata
For the JAR recordsdata to be opened as a standalone program, it is advisable to have the JAVA Runtime Environment. However, if the JRE just isn’t set because the default utility for opening jar recordsdata, your laptop tries using completely different purposes to open the file and fails to take action.
So, it is best to set the JRE because the default utility for opening JAR recordsdata.
Click on the particular Jar file you need to open and right-click it.
Select Open with and Choose one other app.
Check mark Always use this app to open .jar recordsdata choice.
Click on More apps and Look for one more app on this computer.
Navigate to C:Program FilesJavajrebin. (This is the default set up path of Java. If you have got put in it in one other folder, go there as an alternative. The JRE folder might also differ relying in your JRE model.)
Select javaw.exe and hit Open.
You can even enter assoc .jar=jarfile and ftype jarfile="C:(path to your javaw.exe)" -jar "%1" %* command in an Elevated Command Prompt to set JRE because the default utility.
For Example: ftype jarfile="C:Program FilesJavajre1.8.0_341binjavaw.exe”
However, it is advisable to make sure that of the next issues.
Enter the instructions in the identical order.
Ensure to enter the listing path to your JRE within the second command.
Make positive the trail is ready to your JRE as an alternative of JDK.
Use Command Prompt
You can even simply open jar recordsdata using command strains within the Command Prompt.
Here’s how you are able to do it:
Launch Run Utility using Windows key + R key.
Enter cmd to open Command Prompt.
In Command Prompt, kind cd and enter the listing to your .jar file. (If the .jar file is on one other drive, it is advisable to change the chosen drive by getting into the driving force letter.)
If you don’t understand how to enter the folder listing in Command Prompt, you may merely drag and drop the folder from File Explorer to Command Prompt.
Enter the Java -jar <Your Jar filename.jar> command.
If your jar file is non-executable, the above technique received’t work on opening it. You would want to make use of a unique command.
In Command Prompt, enter the command java -cp app.jar com.<package deal identify>.<class identify>
If you weren’t the one to create the jar file and due to this fact have no idea the package deal identify and class identify, you may look it up on the downloaded web site.
Setup a BAT File
Another technique you should use to open .jar recordsdata is by making a .bat file scripted to open a selected file. This technique skips the conventional technique of opening the .jar file and helps resolves points like this.
Follow the steps beneath:
Right-click on the empty space within the folder the place your jar file is situated and select New.
Select Text Document and open the doc as is.
Type in Java -jar <Your Jar filename.jar>
Go to File > Save as.
Make positive the Save as kind choice is chosen as All recordsdata.
Name the textual content doc something you need, however embrace a .bat extension on the finish.
Open the .bat file.
For non-executable .jar recordsdata, you should use the identical command as above to create a .bat file that opens it.
Use Compatible Java Version
If you have got a number of Java variations and are attempting to open a jar file made in a unique model of Java from the one you’re using to open it, the jar file could not open. While Java is meant to be backward suitable, you should still face this problem generally.
To remedy this, you need to outline a suitable model with which the jar file ought to open.
Here’s how you are able to do it:
Right-click your jar file and faucet on Create shortcut.
Right-click the shortcut and choose Properties.
Next to goal, enter the next: “C:(path to your compatible jdk or jre version)” -jar “C:(path to your jarfile.jar)” For e.g. "C:Program FilesJavajre1.8.0_341binjavaw.exe" -jar "C:UsersUsernameDownloadsmyjarfile.jar"
Click Apply and OK.
Open the shortcut.
You can even use this technique within the Command immediate or create a bat file to open jar recordsdata.
Reinstall JAVA Runtime Environment
The jar recordsdata can’t begin as a standalone program with out JRE, so JRE should be working correctly to open jar recordsdata.
If there are any errors in JAVA Runtime Environment, you may reinstall a clear new copy to nullify any points plaguing it.
Follow the steps beneath to reinstall it:
Access Settings from the Start menu.
Navigate to Apps > Apps & options.
Locate Java and click on on choices button on the left.
Jarfix is a legit software program that many Java builders use to troubleshoot points with jar recordsdata. So, you may run Jarfix to repair points together with your jar recordsdata, together with points like jar recordsdata refusing to open.
It is a light-weight program and doesn’t use many system sources. However, make sure to obtain this program from a trusted web site.