Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
    • Linux
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Facebook Twitter Instagram
Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
    • Linux
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Tech News Today
Home»Software»JAR File Not Opening on Windows? Here’s How to Fix It

JAR File Not Opening on Windows? Here’s How to Fix It

Bishwo TamliBy Bishwo TamliSeptember 20, 2022
jar file not opening

JAR files, also called Java Archives files, are archives of Java class files. In a nutshell, JAR files are groups of files that can contain images, audio, visuals, etc., and can run as a single executable program when paired with the Java Runtime Environment.

They are predominantly used by Java developers for coding and programming. However, jar files refusing to open is one of the many issues that can happen while using them.

Table of Contents

  • Why Does My JAR File Not Open?
  • How to Fix JAR File Not Opening?
    • Set JRE as Default for JAR files
    • Use Command Prompt
    • Setup a BAT File
    • Use Compatible Java Version
    • Reinstall JAVA Runtime Environment
    • Run Jarfix

Why Does My JAR File Not Open?

Here are the possible causes for your jar file refusing to open.

  • JAR file set to open with other applications.
  • Java Runtime Environment having issues.
  • Incompatible JRE or JDK version
  • Incorrect Filename Extension

How to Fix JAR File Not Opening?

There are several methods you can use to fix JAR files not opening. However, before you begin, ensure the JAR file has the correct filename extension. To do so, go to the View tab and enable File name extensions. Make sure the JAR file has .jar at the end.

Make your way down the list of fixes to see which one works for you. 

Set JRE as Default for JAR files

For the JAR files to be opened as a standalone program, you need to have the JAVA Runtime Environment. However, if the JRE is not set as the default application for opening jar files, your computer tries using different applications to open the file and fails to do so.

So, you should set the JRE as the default application for opening JAR files.

  1. Click on the specific Jar file you want to open and right-click it.
  2. Select Open with and Choose another app.
    jar file choose more
  3. Check mark Always use this app to open .jar files option.
  4. Click on More apps and Look for another app on this pc.
    look for another app on this pc
  5. Navigate to C:\Program Files\Java\jre\bin. (This is the default installation path of Java. If you have installed it in another folder, go there instead. The JRE folder may also differ depending on your JRE version.)
  6. Select javaw.exe and hit Open.
    javaw

You can also enter assoc .jar=jarfile and ftype jarfile="C:\(path to your javaw.exe)" -jar "%1" %* command in an Elevated Command Prompt to set JRE as the default application.

For Example:
ftype jarfile="C:\Program Files\Java\jre1.8.0_341\bin\javaw.exe”

However, you need to make sure of the following things.

  • Enter the commands in the same order.
  • Ensure to input the directory path to your JRE in the second command.
  • Make sure the path is set to your JRE instead of JDK.

Use Command Prompt

You can also easily open jar files using command lines in the Command Prompt.

Here’s how you can do it:

  1. Launch Run Utility using Windows key + R key.
  2. Enter cmd to open Command Prompt.
  3. In Command Prompt, type cd and enter the directory to your .jar file. (If the .jar file is on another drive, you need to change the selected drive by entering the driver letter.)
  4. If you don’t know how to enter the folder directory in Command Prompt, you can simply drag and drop the folder from File Explorer to Command Prompt.
  5. Enter the Java -jar <Your Jar filename.jar> command.
    jar opening command

If your jar file is non-executable, the above method won’t work on opening it. You would need to use a different command.

  1. In Command Prompt, enter the command java -cp app.jar com.<package name>.<class name>
    non executable jar file opening command
  2. If you were not the one to create the jar file and therefore do not know the package name and class name, you can look it up on the downloaded website.

Setup a BAT File

Another method you can use to open .jar files is by creating a .bat file scripted to open a particular file. This method skips the normal method of opening the .jar file and helps resolves issues like this.

Follow the steps below:

  1. Right-click on the empty area in the folder where your jar file is located and choose New.
  2. Select Text Document and open the document as is.
    new text document
  3. Type in Java -jar <Your Jar filename.jar>
    jar file opening bat fi;e
  4. Go to File > Save as.
  5. Make sure the Save as type option is selected as All files.
  6. Name the text document anything you want, but include a .bat extension at the end.
    save bat file
  7. Click Save.
  8. Open the .bat file.

For non-executable .jar files, you can use the same command as above to create a .bat file that opens it.

Use Compatible Java Version

If you have multiple Java versions and are trying to open a jar file made in a different version of Java from the one you are using to open it, the jar file may not open. While Java is supposed to be backward compatible, you may still face this issue sometimes.

To solve this, you must define a compatible version with which the jar file should open.

Here’s how you can do it:

  1. Right-click your jar file and tap on Create shortcut.
    jar file create shortcut
  2. Right-click the shortcut and select Properties.
  3. Next to target, enter the following: “C:\(path to your compatible jdk or jre version)” -jar “C:\(path to your jarfile.jar)”
    For e.g. "C:\Program Files\Java\jre1.8.0_341\bin\javaw.exe" -jar "C:\Users\Username\Downloads\myjarfile.jar"
    shotcut target
  4. Click Apply and OK.
  5. Open the shortcut.

You can also use this method in the Command prompt or create a bat file to open jar files.

Reinstall JAVA Runtime Environment

The jar files can not start as a standalone program without JRE, so JRE must be working properly to open jar files.

If there are any errors in JAVA Runtime Environment, you can reinstall a clean new copy to nullify any issues plaguing it.

Follow the steps below to reinstall it:

  1. Access Settings from the Start menu.
  2. Navigate to Apps > Apps & features.
  3. Locate Java and click on options button on the left.
  4. Select Uninstall and confirm Uninstall.
    uninstall java 8
  5. Download the latest Java build from its official website.
  6. Run the setup file to install Java.
    install java 8

Run Jarfix

Jarfix is a legit software that many Java developers use to troubleshoot issues with jar files. So, you can run Jarfix to fix issues with your jar files, including issues like jar files refusing to open.

It is a lightweight program and doesn’t use many system resources. However, be sure to download this program from a trusted website.

fix
Bishwo Tamli

I'm a tech enthusiast, and I've always been troubleshooting errors by myself for years. I also like keeping up to date with the latest technology and gadgets.

Related Posts

How to Disable NVIDIA Overlay

5 Ways to Disable NVIDIA Overlay

February 23, 2023
Notepad++-Plugins-Not-Installing

Notepad++ Plugins Not Installing? 5 Proven Ways to Fix It

February 20, 2023
MSI-Gaming-App-Not-Opening

MSI Gaming App Not Opening? 6 Ways to Fix it

February 17, 2023
MSI Afterburner Not Working

MSI Afterburner Not Working? Try These 7 Fixes

February 17, 2023
check mark in excel

How to Put Check Mark in Excel

January 20, 2023
how to find duplicate in google sheets

How to Find Duplicate in Google Sheets

January 16, 2023
Add A Comment

Leave A Reply Cancel Reply

Latest Posts
Shared GPU Memory

What is Shared GPU Memory? How is It Different From Dedicated VRAM?

March 12, 2023
c drive vs d drive

C Drive Vs D Drive – What’s the Difference?

March 12, 2023
firmware vs software

Firmware Vs Software – What’s the Difference?

March 8, 2023
You may also like
Internet-Keeps-Dropping

Why Does My Internet Keep Dropping? 10 Ways to Fix It

March 16, 2023
hp-printer-light-flashing

Solved: HP Printer Light Flashing

March 16, 2023
scan disk windows 10

How to Scan Disk Windows

March 16, 2023
Recommended
Cookie Clicker Garden Guide

Cookie Clicker Garden Guide to Unlocking Every Seed

September 26, 2021
monitor no signal

Computer Turns On But Monitor Says No Signal (9 Ways To Fix)

November 10, 2022
Facebook Twitter Pinterest
  • Home
  • About Us
  • Our Team
  • Editorial Guidelines
  • Privacy Policy
  • Affiliate Disclosure
© 2023 TechNewsToday, editor@technewstoday.com | Tech Central Pvt. Ltd.

Type above and press Enter to search. Press Esc to cancel.