Unable to Access Jar File Error – (Explained and Resolved)

JAR or Java Archive is a utility that is used to pack many files into one. It is totally based on the ZIP file format, which typically allows users to combine resources related to applets and applications. When Unable to Access JAR File error occurs, it means Windows cannot access it for many different reasons.

Unable to Access Jar File Error
Unable to Access Jar File Error Fix

Mainly, this error occurs when the user type java -jar filename instead of java -jar filename.jar in the command prompt. Here JAR is missing, which is the leading cause of this error, preventing the JAR file from running. However, if you are directly trying to open the JAR file, skip the first two methods, as they are for the users who are facing this error on the command prompt.

Before you move on to the methods, download the latest version of the Java archive utility, as it is required to run the JAR files.

ErrorUnable to Access Jar File
Occurs onlyWhile trying to access JAR files
CausesJava Archieve Utility is not installed.
Incorrect file path and missing extension name
SolutionsCheck the path and name of a JAR file
Run the bat file as an administrator
Download the Java Archive utility

1. Check the path and name of a JAR file

Before applying the in-depth methods, you first need to ensure that your JAR file location contains a correct path with the extension name. If you have unnecessary spaces in the path or forget to mention the extension name of a JAR file, this error will occur.

To keep this simple, copy the JAR file and paste it with the bat or batch file, which will run the jar file. This will help you to avoid writing a long path in the command.

  1. To do so, copy the JAR file and paste it with the bat file.
  2. Then, right-click the bat file, and click Edit.

    Proceeding to edit a bat file
    Proceeding to edit a bat file
  3. Now make sure the file name is correct. You can paste the following command and replace the filename with your JAR file name.
    java -jar filename.jar
  4. If you are getting this error while creating a Minecraft server, try using the following command.
    java -Xmx1024M -Xms1024M -jar server.jar nogui
    Checking the command to run the Jar file
    Checking the command to run the JAR file
  5. Once done, run the bat file or press enter to unpack the file.

2. Run the bat file as an administrator

Unable to access the JAR file can be caused by not having appropriate permissions to run the jar file. Since Windows is showing this error, it means there can be a lack of permissions to your user account, preventing you from running the JAR file. You can try running as an administrator to avoid permission issues.

  1. If you have a bat file created, right-click on it and select Run as administrator.
    Running Windows Batch file as an administrator
    Running Windows Batch file as an administrator
  2. .If not, go to the location where the JAR file is located, type CMD in the address bar, and hit Enter to open the command prompt.
    Opening Command Prompt
    Opening Command Prompt
  3. Type java -jar filename.jar and replace the filename with the actual JAR file name.
    Running JAR file using command prompt
    Running JAR file using command prompt
  4. Not hit Enter and see if the error persists.

3. Download the compatible Java version for a JAR File

It is important to figure out what java version is used to compile the JAR file you are trying to run. If the JAR file has compiled in java 7 and you are trying to open it with java 15, this error will occur. Therefore, it is essential to install the compatible java version to run the JAR file.

You can try installing the multiple JAVA archive utility to determine which JAVA version is used to compile your JAR file.

  1. To download the java version, open the browser and search for Download java 15 or 17.
  2. Go to the first website, which should be oracle.com.
  3. Download the installer from there.
    Downloading the Java installer
    Downloading the Java installer
  4. Once done, double-click on it and follow the simple instructions to install it.
    Installing Java (TM) SE Development Kit
    Installing Java (TM) SE Development Kit
  5. Once done, try running the JAR file to check if the error is fixed.

4. Give appropriate permissions to the parent JAR file folder

Every folder has security settings that allow users to manage the permissions of the folder. When you create a new folder, the user has all the permissions required to access the files. However, if you don’t have permission to write the data under the parent folder, it will result in this error message. Therefore, try changing the permissions settings to see whether the error persists or not.

To give the permissions, follow the steps:

  1. Right-click the folder where the JAR file is located and go to Properties.
    Navigating to folder properties
    Navigating to folder properties
  2. Then go to the Security tab.
  3. Click Advanced and click Add.
    Opening Advanced Security Settings
    Opening Advanced Security Settings
  4. Then, click Select a principal and enter the username of your account.
    Moving to add a user in security folder settings
    Moving to add a user in the security folder settings
  5. Then, click Check Names.
    Selecting username to add a user account in security settings
    Selecting a username to add a user account in the security settings
  6. In case you cannot find the local account by typing the name, click Advanced, then click Find Now.
  7. Find and select the local account from the results. Then, click OK.
    Selecting the username of a local account from the results
    Selecting the username of a local account from the results
  8. Again, click OK to select the local account.
  9. Tick Full Control and then click OK.
    Assigning permissions to the folder
    Assigning permissions to the folder
  10. Click Apply and click OK to close the permission Window.
  11. Once done, make sure all the user names and group has full control permission over the folder.
    Making sure that every group or username has full control over the folder
    Making sure that every group or username has full control over the folder
  12. Click OK to close the properties Window.
  13. Once done, go to the folder and run the Jar file to see if the error is fixed.

5. Run the JAR file with Java (TM)

Since Java (TM) Platform SE Binary is required to unzip the JAR files, it is possible that you are trying to run it with other programs, which is why you are encountering this error. Hence, try running it with Java (TM) Platform SE Binary which is included in Java. Hence, it is important to download the Java archive utility from the website before executing the following steps:

To run the JAR file:

  1. Right-click the JAR file, hover Open With and then select Java (TM) Platform SE Binary.

    Opening JAR file with Java (TM) Platform SE Binary
    Opening JAR file with Java (TM) Platform SE Binary
  2. If the Java (TM) Platform SE Binary is not available under suggested apps or more options, click Choose another program, then Select an app on your pc.
    Browsing the program to open the JAR file
    Browsing the program to open the JAR file
  3. Go to the folder where Java is installed, navigate to the bin folder, select the Java application, and click Open.
    Opening JAR file with the java application
    Opening the JAR file with the java application
  4. Once done, you will see Java (TM) Platform SE Binary under the listed apps, select it and click Always to run the JAR file.
  5. Once done, check if the error is fixed.

- FAQs

What is a JAR File?

JJAR file is the same as a Zip file, used to combine many files into one. Even though the JAR file can be used as a normal archive utility, the main goal for the JAR to be introduced to the world is to store Java components, plugins, and applets into one file

Why can’t I access a JAR file?

Usually, when it says Unable to access JAR file, it is because you don’t have the JAVA archive utility installed. To access the JAR file, you need to install the JAVA archive utility.

How to open JAR files with Java?

To run the JAR files, go to the directory where the JAR file is stored, type CMD in the address bar, and hit Enter. Once the command prompt is opened, type java -jar filename.jar in the command prompt, but replace the filename with your JAR file name. Once done, hit Enter to run the JAR file. Despite doing all of this, the easy way is to run the JAR file by double-clicking on it,

How to Fix Unable to Access Jar File?

Just download and install the latest version of the JAVA archive utility. Then, try running the JAR file. If the error persists, you need to download a different version of JAVA, which is used to compile the JAR file

ABOUT THE AUTHOR

Hamza Mohammad Anwar


Hamza Mohammad Anwar is an intermediate JavaScript web developer with a focus on developing high-performance applications using MERN technologies. His skill set includes expertise in ReactJS, MongoDB, Express NodeJS, and other related technologies. Hamza is also a Google IT Certified professional, which highlights his competence in IT support. As an avid problem-solver, he recreates errors on his computer to troubleshoot and find solutions to various technical issues.