Linux error unable to access jarfile

I want to execute my program without using an IDE. I've created a jar file and an exectuable jar file. When I double click the exe jar file, nothing happens, and when I try to use the command in ...

I want to execute my program without using an IDE.
I’ve created a jar file and an exectuable jar file. When
I double click the exe jar file, nothing happens, and when I try to use the command in cmd it gives me this:

Error: Unable to access jarfile <path>

I use the command: java -jar Calculator.jar

How I created the jar:

  1. Right click on project folder (Calculator)
  2. Select
  3. Click on Java Folder and select «Exectuable Jar File», then select next
  4. Launch Configuration: Main — Calculator
  5. Create Export Destination
  6. Hit «Finish» and profit! Well, not really.

Raedwald's user avatar

Raedwald

45.4k39 gold badges149 silver badges234 bronze badges

asked Aug 14, 2012 at 0:01

Joseph Smith's user avatar

Joseph SmithJoseph Smith

3,1335 gold badges19 silver badges18 bronze badges

12

I had encountered this issue when I had run my Jar file as

java -jar TestJar

instead of

java -jar TestJar.jar

Missing the extension .jar also causes this issue.

answered Sep 16, 2014 at 10:26

Vinay Kadalagi's user avatar

Vinay KadalagiVinay Kadalagi

1,2551 gold badge8 silver badges11 bronze badges

3

Fixed

I just placed it in a different folder and it worked.

Paolo Forgia's user avatar

Paolo Forgia

6,4928 gold badges46 silver badges58 bronze badges

answered Aug 15, 2012 at 4:05

Joseph Smith's user avatar

Joseph SmithJoseph Smith

3,1335 gold badges19 silver badges18 bronze badges

8

[Possibly Windows only]

Beware of spaces in the path, even when your jar is in the current working directory. For example, for me this was failing:

java -jar myjar.jar

I was able to fix this by givng the full, quoted path to the jar:

java -jar "%~dp0myjar.jar" 

Credit goes to this answer for setting me on the right path….

Community's user avatar

answered Mar 15, 2016 at 3:15

Robert Brown's user avatar

Robert BrownRobert Brown

10.8k6 gold badges34 silver badges40 bronze badges

2

I had this issue under CygWin in Windows. I have read elsewhere that Java does not understand the CygWin paths (/cygdrive/c/some/dir instead of C:somedir) — so I used a relative path instead: ../../some/dir/sbt-launch.jar.

answered Aug 4, 2016 at 17:18

radumanolescu's user avatar

radumanolescuradumanolescu

3,9691 gold badge28 silver badges41 bronze badges

3

I had the same issue when trying to launch the jar file. The path contained a space, so I had to place quotes around. Instead of:

java -jar C:Path to FilemyJar.jar

i had to write

java -jar "C:Path to FilemyJar.jar"

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

answered Sep 6, 2015 at 18:05

benez's user avatar

2

Just came across the same problem trying to make a bad USB…

I tried to run this command in admin cmd

java -jar c:fwduckyduckencode.jar -I c:fwduckyHelloWorld.txt  -o c:fwduckyinject.bin

But got this error:

Error: unable to access jarfile c:fwduckyduckencode.jar

Solution

1st step

Right click the jarfile in question. Click properties.
Click the unblock tab in bottom right corner.
The file was blocked, because it was downloaded and not created on my PC.

2nd step

In the cmd I changed the directory to where the jar file is located.

cd C:fwducky

Then I typed dir and saw the file was named duckencode.jar.jar

So in cmd I changed the original command to reference the file with .jar.jar

java -jar c:fwduckyduckencode.jar.jar -I c:fwduckyHelloWorld.txt  -o c:fwduckyinject.bin

That command executed without error messages and the inject.bin I was trying to create was now located in the directory.

Hope this helps.

mcls's user avatar

mcls

8,7132 gold badges28 silver badges28 bronze badges

answered Oct 23, 2015 at 20:26

Leon thomas's user avatar

2

None of the provided answers worked for me on macOS 11 Big Sur. The problem turned out to be that programs require special permission to access the Desktop, Documents, and Downloads folders, and Java breaks both the exception for directly opened files and the permission request popup.

Fixes:

  • Move the .jar into a folder that isn’t (and isn’t under) Documents, Desktop, or Downloads.
  • Manually grant the permission. Go to System Preferences → Security and Privacy → Privacy → Files and Folders → java, and check the appropriate folders.

answered Jan 27, 2021 at 9:50

twhb's user avatar

twhbtwhb

4,2042 gold badges18 silver badges22 bronze badges

I had a similar problem and I even tried running my CMD with administrator rights, but it did not solve the problem.

The basic thing is to make sure to change the Directory in cmd to the current directory where your jar file is.

Do the following steps:

  1. Copy jar file to Desktop.

  2. Run CMD

  3. Type command cd desktop

  4. Then type java -jar filename.jar

This should work.


Edit: From JDK-11 onwards ( JEP 330: Launch Single-File Source-Code Programs )

Since Java 11, java command line tool has been able to run a single-file source-code directly. e.g.

java filename.java

Gabor Dicso's user avatar

answered Dec 26, 2018 at 6:22

Vishwa Ratna's user avatar

Vishwa RatnaVishwa Ratna

5,2635 gold badges32 silver badges55 bronze badges

If you are using OSX, downloaded files are tagged with a security flag that prevents unsigned applications from running.

to check this you can view extended attributes on the file

$ ls -l@
-rw-r--r--@ 1 dave  staff  17663235 13 Oct 11:08 server-0.28.2-java8.jar
com.apple.metadata:kMDItemWhereFroms         619
com.apple.quarantine          68

You can then clear the attributes with

xattr -c file.jar

answered Oct 13, 2017 at 10:24

nick fox's user avatar

nick foxnick fox

5608 silver badges15 bronze badges

1

It can also happen if you don’t properly supply your list of parameters. Here’s what I was doing:

java -jar test@gmail.com testing_subject file.txt test_send_emails.jar

Instead of the correct version:

java -jar test_send_emails.jar test@gmail.com testing_subject file.txt

answered Jul 15, 2015 at 8:06

Buffalo's user avatar

BuffaloBuffalo

3,7837 gold badges43 silver badges68 bronze badges

This worked for me.

cd /path/to/the/jar/

java -jar ./Calculator.jar

answered Nov 15, 2016 at 18:18

Bastian Cáceres Pino's user avatar

For me it happens if you use native Polish chars in foldername that is in the PATH.
So maybe using untypical chars was the reason of the problem.

answered Oct 8, 2015 at 9:52

Huxwell's user avatar

HuxwellHuxwell

1512 silver badges13 bronze badges

sometime it happens when you try to (run or create) a .jar file under /libs folder by right click it in android studio. you can select the dropdown in top of android stuio and change it to app. This will work

enter image description here

answered Feb 17, 2016 at 10:44

anand krish's user avatar

anand krishanand krish

4,1014 gold badges40 silver badges47 bronze badges

My particular issue was caused because I was working with directories that involved symbolic links (shortcuts). Consequently, trying java -jar ../../myJar.jar didn’t work because I wasn’t where I thought I was.

Disregarding relative file paths fixed it right up.

answered Nov 18, 2015 at 23:31

MattSayar's user avatar

MattSayarMattSayar

2,0686 gold badges23 silver badges28 bronze badges

In my case the suggested file name to be used was jarFile*.jar in the command line. The file in the folder was jarFile-1.2.3.jar . So I renamed the file to jarFile. Then I used jarFile.jar instead of jarFile*.jar and then the problem got resolved

answered Jan 22, 2017 at 6:41

suku's user avatar

sukusuku

10.2k15 gold badges74 silver badges117 bronze badges

1

It can happen on a windows machine when you have spaces in the names of the folder. The solution would be to enter the path between » «.
For example:

java -jar c:my folderx.jar    --> 
java -jar "c:my folderx.jar"

Sundar's user avatar

Sundar

4,5406 gold badges35 silver badges60 bronze badges

answered Oct 31, 2017 at 8:57

assaf's user avatar

assafassaf

211 bronze badge

1

To avoid any permission issues, try to run it as administrator. This worked for me on Win10.

answered Mar 14, 2018 at 15:14

Gico's user avatar

GicoGico

1,2362 gold badges15 silver badges30 bronze badges

1

I know this thread is years ago and issue was fixed too. But I hope this would helps someone else in future since I’ve encountered some similar issues while I tried to install Oracle WebLogic 12c and Oracle OFR in which its installer is in .jar format. For mine case, it was either didn’t wrap the JDK directory in quotes or simply typo.

Run Command Prompt as administrator and execute the command in this format. Double check the sentence if there is typo.

"C:Program FilesJavajdk1.xxxxxbinjava" -jar C:UsersxxxDownloadsxxx.jar

If it shows something like JRE 1.xxx is not a valid JDK Java Home, make sure the System variables for JAVA_HOME in Environment Variables is pointing to the correct JDK directory. JDK 1.8 or above is recommended (2018).

A useful thread here, you may refer it: Why its showing your JDK c:program filesjavajre7 is not a valid JDK while instaling weblogic server?

answered Oct 23, 2018 at 6:54

not_Prince's user avatar

not_Princenot_Prince

3201 silver badge17 bronze badges

For me it happen because i run it with default java version (7) and not with compiled java version (8) used to create this jar.

So i used:

%Java8_64%binjava -jar myjar.jar

Instead of java 7 version:

java -jar myjar.jar

answered Feb 9, 2020 at 19:19

Adir D's user avatar

Adir DAdir D

1,15012 silver badges20 bronze badges

I had a similar problem where TextMate or something replaced the double quotes with the unicode double quotes.

Changing my SELENIUM_SERVER_JAR from the unicode double quotes to regular double quotes and that solved my problem.

answered Mar 30, 2016 at 18:05

TankorSmash's user avatar

TankorSmashTankorSmash

12k6 gold badges66 silver badges103 bronze badges

this is because you are looking for the file in the wrong path
1. look for the path of the folder where you placed the file
2. change the directory cd in cmd use the right path

answered Jun 19, 2016 at 21:39

felipe's user avatar

0

I use NetBeans and had the same issue. After I ran build and clean project my program was executable. The Java documentation says that the build/clean command is for rebuilding the project from scratch basically and removing any past compiles. I hope this helps. Also, I’d read the documentation. Oracle has NetBeans and Java learning trails. Very helpful. Good luck!

answered Jul 16, 2017 at 13:43

user8315373's user avatar

Maybe you have specified the wrong version of your jar.

answered Sep 21, 2017 at 21:52

cosbor11's user avatar

cosbor11cosbor11

13.5k10 gold badges52 silver badges67 bronze badges

I finally pasted my jar file into the same folder as my JDK so I didn’t have to include the paths. I also had to open the command prompt as an admin.

  1. Right click Command Prompt and «Run as administrator»
  2. Navigate to the directory where you saved your jdk to
  3. In the command prompt type: java.exe -jar <jar file name>.jar

answered Jan 14, 2020 at 15:04

Michaela Burns's user avatar

Keep the file in same directory where you are extracting it. That worked for me.

answered Jan 22, 2020 at 2:18

Aishwary joshi's user avatar

Aishwary joshiAishwary joshi

611 gold badge1 silver badge4 bronze badges

This is permission issue, see if the directory is under your User.
That’s why is working in another folder!

answered Jul 31, 2020 at 13:05

Dimitrios's user avatar

DimitriosDimitrios

1,12311 silver badges10 bronze badges

Rename the jar file and try

Explanation :
yes, I know there are many answers still I want to add one point here which I faced.

I built the jar and I moved it into the server where I deploy (This is the normal process)
here the file name which I moved already existed in the server, here the file will override obviously right. In this case, I faced this issue.
maybe at the time of overriding there can be a permission copy issue.

Hope this will help someone.

answered Aug 3, 2020 at 14:12

Sainath Pabba's user avatar

Have you tried to run it under administrator privoleges?
meaning, running the command in «Run As» and then select administrator with proper admin credentials

worked for me

answered May 14, 2019 at 20:28

Nick_Stubborn_Mex.'s user avatar

I was trying this:

After giving the file read, write, execute priviledges:

chmod 777 java-repl.jar

alias jr="java -jar $HOME/Dev/java-repl/java-repl.jar"

Unable to access bla bla…, this was on Mac OS though

So I tried this:

alias jr="cd $HOME/Dev/java-repl/ && java -jar java-repl.jar"

Litisqe Kumar's user avatar

answered Jul 23, 2019 at 8:53

Kinglee's user avatar

KingleeKinglee

531 silver badge8 bronze badges

This did not work «Unable to access jarfile»

"C:Program Filesjavajdk-13+33-jrebinjavaw.exe" -jar "C:Program FilesMaxim Integrated Products1-Wire Drivers x64 OneWireViewer.jar"

This does work

"C:Program Filesjavajdk-13+33-jrebinjavaw.exe" -jar "C:Program FilesMaxim Integrated Products1-Wire Drivers x64OneWireViewer.jar"

The difference is the single space in front of OneWireViewer.jar not withstanding that it is surrounded with quotes and even has other spaces.

answered Oct 13, 2019 at 15:21

angar's user avatar

I want to execute my program without using an IDE.
I’ve created a jar file and an exectuable jar file. When
I double click the exe jar file, nothing happens, and when I try to use the command in cmd it gives me this:

Error: Unable to access jarfile <path>

I use the command: java -jar Calculator.jar

How I created the jar:

  1. Right click on project folder (Calculator)
  2. Select
  3. Click on Java Folder and select «Exectuable Jar File», then select next
  4. Launch Configuration: Main — Calculator
  5. Create Export Destination
  6. Hit «Finish» and profit! Well, not really.

Raedwald's user avatar

Raedwald

45.4k39 gold badges149 silver badges234 bronze badges

asked Aug 14, 2012 at 0:01

Joseph Smith's user avatar

Joseph SmithJoseph Smith

3,1335 gold badges19 silver badges18 bronze badges

12

I had encountered this issue when I had run my Jar file as

java -jar TestJar

instead of

java -jar TestJar.jar

Missing the extension .jar also causes this issue.

answered Sep 16, 2014 at 10:26

Vinay Kadalagi's user avatar

Vinay KadalagiVinay Kadalagi

1,2551 gold badge8 silver badges11 bronze badges

3

Fixed

I just placed it in a different folder and it worked.

Paolo Forgia's user avatar

Paolo Forgia

6,4928 gold badges46 silver badges58 bronze badges

answered Aug 15, 2012 at 4:05

Joseph Smith's user avatar

Joseph SmithJoseph Smith

3,1335 gold badges19 silver badges18 bronze badges

8

[Possibly Windows only]

Beware of spaces in the path, even when your jar is in the current working directory. For example, for me this was failing:

java -jar myjar.jar

I was able to fix this by givng the full, quoted path to the jar:

java -jar "%~dp0myjar.jar" 

Credit goes to this answer for setting me on the right path….

Community's user avatar

answered Mar 15, 2016 at 3:15

Robert Brown's user avatar

Robert BrownRobert Brown

10.8k6 gold badges34 silver badges40 bronze badges

2

I had this issue under CygWin in Windows. I have read elsewhere that Java does not understand the CygWin paths (/cygdrive/c/some/dir instead of C:somedir) — so I used a relative path instead: ../../some/dir/sbt-launch.jar.

answered Aug 4, 2016 at 17:18

radumanolescu's user avatar

radumanolescuradumanolescu

3,9691 gold badge28 silver badges41 bronze badges

3

I had the same issue when trying to launch the jar file. The path contained a space, so I had to place quotes around. Instead of:

java -jar C:Path to FilemyJar.jar

i had to write

java -jar "C:Path to FilemyJar.jar"

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

answered Sep 6, 2015 at 18:05

benez's user avatar

2

Just came across the same problem trying to make a bad USB…

I tried to run this command in admin cmd

java -jar c:fwduckyduckencode.jar -I c:fwduckyHelloWorld.txt  -o c:fwduckyinject.bin

But got this error:

Error: unable to access jarfile c:fwduckyduckencode.jar

Solution

1st step

Right click the jarfile in question. Click properties.
Click the unblock tab in bottom right corner.
The file was blocked, because it was downloaded and not created on my PC.

2nd step

In the cmd I changed the directory to where the jar file is located.

cd C:fwducky

Then I typed dir and saw the file was named duckencode.jar.jar

So in cmd I changed the original command to reference the file with .jar.jar

java -jar c:fwduckyduckencode.jar.jar -I c:fwduckyHelloWorld.txt  -o c:fwduckyinject.bin

That command executed without error messages and the inject.bin I was trying to create was now located in the directory.

Hope this helps.

mcls's user avatar

mcls

8,7132 gold badges28 silver badges28 bronze badges

answered Oct 23, 2015 at 20:26

Leon thomas's user avatar

2

None of the provided answers worked for me on macOS 11 Big Sur. The problem turned out to be that programs require special permission to access the Desktop, Documents, and Downloads folders, and Java breaks both the exception for directly opened files and the permission request popup.

Fixes:

  • Move the .jar into a folder that isn’t (and isn’t under) Documents, Desktop, or Downloads.
  • Manually grant the permission. Go to System Preferences → Security and Privacy → Privacy → Files and Folders → java, and check the appropriate folders.

answered Jan 27, 2021 at 9:50

twhb's user avatar

twhbtwhb

4,2042 gold badges18 silver badges22 bronze badges

I had a similar problem and I even tried running my CMD with administrator rights, but it did not solve the problem.

The basic thing is to make sure to change the Directory in cmd to the current directory where your jar file is.

Do the following steps:

  1. Copy jar file to Desktop.

  2. Run CMD

  3. Type command cd desktop

  4. Then type java -jar filename.jar

This should work.


Edit: From JDK-11 onwards ( JEP 330: Launch Single-File Source-Code Programs )

Since Java 11, java command line tool has been able to run a single-file source-code directly. e.g.

java filename.java

Gabor Dicso's user avatar

answered Dec 26, 2018 at 6:22

Vishwa Ratna's user avatar

Vishwa RatnaVishwa Ratna

5,2635 gold badges32 silver badges55 bronze badges

If you are using OSX, downloaded files are tagged with a security flag that prevents unsigned applications from running.

to check this you can view extended attributes on the file

$ ls -l@
-rw-r--r--@ 1 dave  staff  17663235 13 Oct 11:08 server-0.28.2-java8.jar
com.apple.metadata:kMDItemWhereFroms         619
com.apple.quarantine          68

You can then clear the attributes with

xattr -c file.jar

answered Oct 13, 2017 at 10:24

nick fox's user avatar

nick foxnick fox

5608 silver badges15 bronze badges

1

It can also happen if you don’t properly supply your list of parameters. Here’s what I was doing:

java -jar test@gmail.com testing_subject file.txt test_send_emails.jar

Instead of the correct version:

java -jar test_send_emails.jar test@gmail.com testing_subject file.txt

answered Jul 15, 2015 at 8:06

Buffalo's user avatar

BuffaloBuffalo

3,7837 gold badges43 silver badges68 bronze badges

This worked for me.

cd /path/to/the/jar/

java -jar ./Calculator.jar

answered Nov 15, 2016 at 18:18

Bastian Cáceres Pino's user avatar

For me it happens if you use native Polish chars in foldername that is in the PATH.
So maybe using untypical chars was the reason of the problem.

answered Oct 8, 2015 at 9:52

Huxwell's user avatar

HuxwellHuxwell

1512 silver badges13 bronze badges

sometime it happens when you try to (run or create) a .jar file under /libs folder by right click it in android studio. you can select the dropdown in top of android stuio and change it to app. This will work

enter image description here

answered Feb 17, 2016 at 10:44

anand krish's user avatar

anand krishanand krish

4,1014 gold badges40 silver badges47 bronze badges

My particular issue was caused because I was working with directories that involved symbolic links (shortcuts). Consequently, trying java -jar ../../myJar.jar didn’t work because I wasn’t where I thought I was.

Disregarding relative file paths fixed it right up.

answered Nov 18, 2015 at 23:31

MattSayar's user avatar

MattSayarMattSayar

2,0686 gold badges23 silver badges28 bronze badges

In my case the suggested file name to be used was jarFile*.jar in the command line. The file in the folder was jarFile-1.2.3.jar . So I renamed the file to jarFile. Then I used jarFile.jar instead of jarFile*.jar and then the problem got resolved

answered Jan 22, 2017 at 6:41

suku's user avatar

sukusuku

10.2k15 gold badges74 silver badges117 bronze badges

1

It can happen on a windows machine when you have spaces in the names of the folder. The solution would be to enter the path between » «.
For example:

java -jar c:my folderx.jar    --> 
java -jar "c:my folderx.jar"

Sundar's user avatar

Sundar

4,5406 gold badges35 silver badges60 bronze badges

answered Oct 31, 2017 at 8:57

assaf's user avatar

assafassaf

211 bronze badge

1

To avoid any permission issues, try to run it as administrator. This worked for me on Win10.

answered Mar 14, 2018 at 15:14

Gico's user avatar

GicoGico

1,2362 gold badges15 silver badges30 bronze badges

1

I know this thread is years ago and issue was fixed too. But I hope this would helps someone else in future since I’ve encountered some similar issues while I tried to install Oracle WebLogic 12c and Oracle OFR in which its installer is in .jar format. For mine case, it was either didn’t wrap the JDK directory in quotes or simply typo.

Run Command Prompt as administrator and execute the command in this format. Double check the sentence if there is typo.

"C:Program FilesJavajdk1.xxxxxbinjava" -jar C:UsersxxxDownloadsxxx.jar

If it shows something like JRE 1.xxx is not a valid JDK Java Home, make sure the System variables for JAVA_HOME in Environment Variables is pointing to the correct JDK directory. JDK 1.8 or above is recommended (2018).

A useful thread here, you may refer it: Why its showing your JDK c:program filesjavajre7 is not a valid JDK while instaling weblogic server?

answered Oct 23, 2018 at 6:54

not_Prince's user avatar

not_Princenot_Prince

3201 silver badge17 bronze badges

For me it happen because i run it with default java version (7) and not with compiled java version (8) used to create this jar.

So i used:

%Java8_64%binjava -jar myjar.jar

Instead of java 7 version:

java -jar myjar.jar

answered Feb 9, 2020 at 19:19

Adir D's user avatar

Adir DAdir D

1,15012 silver badges20 bronze badges

I had a similar problem where TextMate or something replaced the double quotes with the unicode double quotes.

Changing my SELENIUM_SERVER_JAR from the unicode double quotes to regular double quotes and that solved my problem.

answered Mar 30, 2016 at 18:05

TankorSmash's user avatar

TankorSmashTankorSmash

12k6 gold badges66 silver badges103 bronze badges

this is because you are looking for the file in the wrong path
1. look for the path of the folder where you placed the file
2. change the directory cd in cmd use the right path

answered Jun 19, 2016 at 21:39

felipe's user avatar

0

I use NetBeans and had the same issue. After I ran build and clean project my program was executable. The Java documentation says that the build/clean command is for rebuilding the project from scratch basically and removing any past compiles. I hope this helps. Also, I’d read the documentation. Oracle has NetBeans and Java learning trails. Very helpful. Good luck!

answered Jul 16, 2017 at 13:43

user8315373's user avatar

Maybe you have specified the wrong version of your jar.

answered Sep 21, 2017 at 21:52

cosbor11's user avatar

cosbor11cosbor11

13.5k10 gold badges52 silver badges67 bronze badges

I finally pasted my jar file into the same folder as my JDK so I didn’t have to include the paths. I also had to open the command prompt as an admin.

  1. Right click Command Prompt and «Run as administrator»
  2. Navigate to the directory where you saved your jdk to
  3. In the command prompt type: java.exe -jar <jar file name>.jar

answered Jan 14, 2020 at 15:04

Michaela Burns's user avatar

Keep the file in same directory where you are extracting it. That worked for me.

answered Jan 22, 2020 at 2:18

Aishwary joshi's user avatar

Aishwary joshiAishwary joshi

611 gold badge1 silver badge4 bronze badges

This is permission issue, see if the directory is under your User.
That’s why is working in another folder!

answered Jul 31, 2020 at 13:05

Dimitrios's user avatar

DimitriosDimitrios

1,12311 silver badges10 bronze badges

Rename the jar file and try

Explanation :
yes, I know there are many answers still I want to add one point here which I faced.

I built the jar and I moved it into the server where I deploy (This is the normal process)
here the file name which I moved already existed in the server, here the file will override obviously right. In this case, I faced this issue.
maybe at the time of overriding there can be a permission copy issue.

Hope this will help someone.

answered Aug 3, 2020 at 14:12

Sainath Pabba's user avatar

Have you tried to run it under administrator privoleges?
meaning, running the command in «Run As» and then select administrator with proper admin credentials

worked for me

answered May 14, 2019 at 20:28

Nick_Stubborn_Mex.'s user avatar

I was trying this:

After giving the file read, write, execute priviledges:

chmod 777 java-repl.jar

alias jr="java -jar $HOME/Dev/java-repl/java-repl.jar"

Unable to access bla bla…, this was on Mac OS though

So I tried this:

alias jr="cd $HOME/Dev/java-repl/ && java -jar java-repl.jar"

Litisqe Kumar's user avatar

answered Jul 23, 2019 at 8:53

Kinglee's user avatar

KingleeKinglee

531 silver badge8 bronze badges

This did not work «Unable to access jarfile»

"C:Program Filesjavajdk-13+33-jrebinjavaw.exe" -jar "C:Program FilesMaxim Integrated Products1-Wire Drivers x64 OneWireViewer.jar"

This does work

"C:Program Filesjavajdk-13+33-jrebinjavaw.exe" -jar "C:Program FilesMaxim Integrated Products1-Wire Drivers x64OneWireViewer.jar"

The difference is the single space in front of OneWireViewer.jar not withstanding that it is surrounded with quotes and even has other spaces.

answered Oct 13, 2019 at 15:21

angar's user avatar

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Specialised Support
  • Ubuntu Servers, Cloud and Juju
  • Server Platforms
  • [SOLVED] Unable to access jarfile

  1. Unable to access jarfile

    I’m currently running Ubuntu on my server and wanting to run a Minecraft modded server for me and my mates. I’ve done this before multiple times but for some reason when I do it now I keep getting the message «Unable to access jarfile»
    I’ve tried fixing this by changing the name and directory and ensuring that I’ve typed it correctly. I’ve also tried changing it from

    Code:

    sudo java -Xms4G -Xmx4G -jar forge-1.8.9-11.15.1.1722-installer nogui

    to

    Code:

    java -jar /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar

    . I’ve also tried doing

    Code:

    sudo chown -R $thomas:$thomas ~

    but no matter anything i do i just can’t get it to work.


  2. Re: Unable to access jarfile

    Thread moved to Server Platforms.


  3. Re: Unable to access jarfile

    Quote Originally Posted by ghostbacon
    View Post

    I keep getting the message «Unable to access jarfile»

    Code:

    java -jar /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar

    I don’t know anything about the specifics of running this particular jar, but I do know something about what is needed for java to execute a jar. If the above command is giving you the above message (or more precisely «Error: Unable to access jarfile /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar») then there are 2 possible causes:
    1. The file does not exist (e.g. perhaps it should be minecraft not minecraf or perhaps there’s a lowercase/uppercase inaccuracy)
    or 2. You do not have read access to it.

    Note that if the jar exists but is corrupt or in some other way invalid, or there are missing dependencies, you will get a different message. What do you get from the following?

    Code:

    ls -l /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar


  4. Re: Unable to access jarfile

    It turns out I did, in fact, spell Minecraft incorrectly although now running this I get the response

    Code:

    A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:62)
        at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:31)
    Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
        at net.minecraft.launchwrapper.Launch.<init>(Launch.java:34)
        at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
        ... 6 more


  5. Re: Unable to access jarfile


  6. Re: Unable to access jarfile

    Make sure whatever version of OpenJDK or Oracle Java you use is compatible with Minecraft 1.8 (which is what Forge 1.8 is based on)

    My guess would be Java 1.8 flavor but I could be wrong.


  7. Re: Unable to access jarfile

    It seems I’ve already got Java 8


  8. Re: Unable to access jarfile

    Quote Originally Posted by ghostbacon
    View Post

    It seems I’ve already got Java 8

    That is surprising because the ClassLoader error you are getting is precisely what you would get when running some Java 8 code from Java 9 or above. The issue is explained here. Note in particular the quotation from the Java 9 release notes.

    If you are actually running the jar with Java 8, then I’m afraid I’ve no idea how you would be getting that error.


  9. Re: Unable to access jarfile

    Update: I decided to uninstall Java and reinstall Java 8, having done this It’s seemed that I’ve completely broken Java as no matter how many times I do it, «java» is not a recognized command. When doing «sudo update-alternatives —config java», I’m returned with «update-alternatives: error: no alternatives for java».


  10. Re: Unable to access jarfile

    The built-in runtime packages for OpenJDK in Ubuntu are:

    Code:

    sudo apt install openjdk-8-jre-headless

    and

    Code:

    sudo apt install openjdk-11-jre-headless

    To install Oracle Java 8, you need to add their repository, then update and install the runtime:

    Code:

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt update
    sudo apt install oracle-java8-installer

    If you have mutliple versions of java installed, you use this command to show/set which java is default when you just type «java»

    Code:

    sudo update-alternatives --config java

    Or you could just specify the path to «java» when you are running the program such as:

    Code:

    /usr/lib/jvm/java-8-oracle/jre/bin/java -jar /home/thomasthetrain/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar

    or

    Code:

    /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/thomasthetrain/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar

    Just make sure you use the path that is setup on your system….rather than copy/paste what I have typed…which may not be accurate to your system.

    LHammonds


Bookmarks

Bookmarks


Posting Permissions

If you have recently tried to open a JAR package file, only to receive the error, “unable to access Jarfile,” this simply means that your computer either doesn’t have the right software to open the file, or you have the wrong file path. Other common reasons for getting this error is if you have an outdated version of Java, your computer is infected with malware, or the default program for opening your JAR files isn’t set correctly. Before we jump into the solutions for this, let’s take a look at what JAR is.

Unable to access jarfile error message on Windows

Understanding JAR Package Files

Java Archive or JAR is a package file format based on ZIP architecture. It is used to group together multiple Java class files, their metadata, and any resources these files need to run into one single package. The purpose of doing this is to then distribute the grouped files as needed for the running of applications and programs. In order to run the executable file in a JAR package, you must have the latest Java Run-Time Environment installed.

Jarfile Examples.

If you are getting the error, “unable to access Jarfile” it means that you are encountering one of the following problems:

  • Your system has malware that is either preventing the Jarfile package to open.
  • The Jarfile package is corrupted from malware.
  • You do not have the latest Java Run-Time Environment installed.
  • The default program for accessing JAR files isn’t set.
  • The file path for the executable Jarfile package is incorrect.

The “unable to access Jarfile” error is quite a common one since there are many popular programs that use Java as their programming language. For instance, Netflix uses it along with Python for applications in its back-end, while Spotify uses it to stabilize data transfer, and Minecraft uses it for its launcher. Other popular programs and services that use Java include: Uber, Amazon, LinkedIn, Google, and Android OS.

1. Update Your Java to the Latest Version

The most likely reason that you are getting the, “unable to access Jarfile” error is due to an outdated version of Java. Unfortunately, outdated versions of Java Run-Time Environment are prone to security risks and loopholes, so keeping it updated is highly recommended regardless of whether you are getting the above error.

  1. In your computer’s search menu, type in “Control Panel”.
  2. In the control panel window, choose “uninstall a program” under programs.
Image of Windows 10 control panel and the uninstall a program option.
  1. In the list of programs, scroll until you see Java. Or use the search program box in the top right-hand corner of the window.
  2. Take a look at the version number and see if it matches the latest release.
  3. If it doesn’t, uninstall the program by right-clicking on it.
Image of how to uninstall Java and see the version number in the uninstall program function on Windows 10.
  1. Choose “yes” when prompted.
  2. From the official Java website, download the latest version.
  3. Once downloaded, use the setup wizard to install Java.

Now, re-try opening your JAR package to see if the problem is fixed.

2. Make Java the Default Program for Opening JAR Packages

If you are still getting the “unable to access Jarfile” error after updating your Java Run-Time Environment to the latest version, then you may not have Java set as the default program to use for opening JAR packages.

  1. In your computer’s taskbar, open File Explorer.
  2. Find the folder that contains your JAR package.
  3. Right-click on the folder and choose “open,” and then Java.
  4. If Java is not listed, select “choose another app”.
Use Java to open your Jarfile package.
  1. In the window that pops up, choose Java from the list. If it is not there, choose the “look for another app on this PC” option.
  2. Browse your computer for Java and find the program. Select it and hit the “open” option.
  3. A prompt window may open. If it does, choose “okay” and “open”.
  4. Double-click on your JAR package executable to open.

When browsing for Java on your computer in step 6, the most common place for it to be is in Program Files (x86)/Java/Java <Version>/Bin/Java.exe. Keep in mind that Java is usually installed to the default hard drive disk where your operating system is, unless you do a custom installation path. So, keep this in mind when trying to find Java on your computer.

3. Set Java as a Default Association Permanently

If you use a lot of programs or applications that use the Java Run-Time Environment, it is recommended that you set Java as a default association permanently in your computer, so that any JAR packages or files are automatically opened by Java.

  1. Press the Windows key and “I” on your keyboard to open Settings. Alternatively, type “settings” into your computer’s search menu.
  2. Click into the “apps” option in the Settings window.
Apps in Settings Window on Windows 10
  1. Choose “default apps” in the left-hand sidebar.
  2. Scroll until you see, “choose default apps by file type” and click it.
  3. Now, look for .jar in the list and click on “Choose a default” next to it.
  4. Find the Java Platform Program (Java Run-Time Environment) on your computer.
  5. Save the changes and exit.
Windows 10 Settings - Apps, Set Java as a Default Program to Use

Now restart your computer for the changes to take effect and see if you can open your JAR package without the, “unable to access Jarfile” error.

4. Check for Malware to Eliminate Infections Causing Trouble

If you are still getting the “unable to access Jarfile” error, it may be from malicious malware. A virus can easily exploit your registry and modify it to make JAR packages unusable. It is highly recommended that you run a thorough scan of your entire computer to look for malware. If you find some, remove it and uninstall Java. Repeat fix 1 in this list to reinstall.

5. Configure Hidden Files/Folders/Drives to Show

While not as common, sometimes hidden files, folders, and drives can cause the “unable to access Jarfile” error.

  1. In your computer’s taskbar, open File Explorer.
  2. At the top of the window, click on the “View tab”.
Click View - Then Options.
  1. Now click on the “Options” button to the far right.
  2. In the new window that opens, click on the “View tab” again.
  3. In the list, choose the “Show hidden files, folders, and drives” option.
  4. Hit Apply and then hit OK.
Checkmark the Show Hidden Files, Folders, and Drives Option.

6. Repair Your Java Programs with Jarfix.

If you are using programs that launch with Java and they are not responding to you, no matter how many times you try to open the application, then it may be time to repair your JAR associations. To do this, simply download Jarfix, a lightweight program that fixes hijacked JAR associations, and run it.

What Jarfix looks like.

7. Check the Documentation If You Are a Developer

If you are working in Java as a developer and come across the “unable to access Jarfile” error, it is likely that there is a minor mistake within the coding. It is recommended that you go back through and re-read to make sure that you have the right file path and the correct parameters for the code to work. Depending on what utility you are using to open and run your JAR packages, you may need to go back through and re-read the documentation on how to get it functioning properly.

Wrapping It Up

In most cases, the “unable to access Jarfile ” error will be solved by updating your Java Run-Time Environment to the latest version, but if it doesn’t solve the problem, please do try out the other methods on this list. Let us know in the comments below if we were able to help you!

Как правильно задавать вопросы

Правильно сформулированный вопрос и его грамотное оформление способствует высокой вероятности получения достаточно содержательного и по существу ответа. Общая рекомендация по составлению тем: 1. Для начала воспользуйтесь поиском форума. 2. Укажите версию ОС вместе с разрядностью. Пример: LM 19.3 x64, LM Sarah x32 3. DE. Если вопрос касается двух, то через запятую. (xfce, KDE, cinnamon, mate) 4. Какое железо. (достаточно вывод inxi -Fxz в спойлере (как пользоваться спойлером смотрим здесь)) или же дать ссылку на hw-probe 5. Суть. Желательно с выводом консоли, логами. 6. Скрин. Просьба указывать 2, 3 и 4 независимо от того, имеет ли это отношение к вопросу или нет. Так же не забываем об общих правилах Как пример вот

no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск .jar-файла

25 сен 2017, 19:16

1) Linux Mint 18.1 32-bit
2) Cinnamon
4)Здравствуйте, не могу открыть программу, на сайте от куда я ее скачал сказано что, в первый раз надо запустить от пользователя root (как войти в пользователь я знаю).
попробовал команду:

вот ответ терминала:

Код: Выделить всё

ubuntu-HP-Compaq-8100-Elite-CMT-PCubuntu # sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar
Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar

не сработало

ВСЕМ БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!!! _________________________ ВСЕМ БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!!!


no avatar

symon2014

Запуск программы

#2

25 сен 2017, 19:25

tortik писал(а): # sudo

Для начала, ты уже в руте .


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск программы

#3

25 сен 2017, 19:35

спасибо но проблемы не решает


Аватара пользователя

Chocobo

Сообщения: 9954
Зарегистрирован: 27 авг 2016, 22:57
Решено: 214
Откуда: НН
Благодарил (а): 795 раз
Поблагодарили: 2980 раз
Контактная информация:

Запуск программы

#4

25 сен 2017, 19:53

tortik, Укажи абсолютный путь к файлу
sudo java -jar /path/to/file.jar

или укажи что он находится в текущей директории
cd /path/to/
sudo java -jar ./file.jar

Изображение

   

Изображение


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск программы

#5

25 сен 2017, 20:25

спасибо за помощь, но терминал отнекивается:

Код: Выделить всё

 sudo java /home/ubuntu/Downloads/cXPBootstrap-1.1.0-SNAPSHOT-production.jar
Error: Could not find or load main class .home.ubuntu.Downloads.cXPBootstrap-1.1.0-SNAPSHOT-production.jar


Аватара пользователя

connor41

Сообщения: 270
Зарегистрирован: 13 июл 2017, 02:19
Решено: 1
Благодарил (а): 71 раз
Поблагодарили: 34 раза
Контактная информация:

Запуск программы

#6

25 сен 2017, 20:30

tortik, напиши не просто java, а java с ключем -jar … java -jar
Приложения лучше не запускать от рута «sudo», если они того не требуют.
.jar файлы ты можешь спокойно открывать двойным щелчком мыши, если программа для открытия по умолчанию установлена JVM

Arch Linux and Linux mint User :smile:
4.14.13-1-zen
i3wm :tux:


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск программы

#7

25 сен 2017, 20:44

При открытии jar файла программа запускается но компьютер говорит что нет прав. Говорит что надо открыть от пользователя root и закрывает программу.

напиши не просто java, а java с ключем -jar … java -jar

тогда получатся два раза подряд java
(попробовал не получилось)
БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!!! (и извини за вредный компьютер)


Аватара пользователя

rogoznik

Сообщения: 9443
Зарегистрирован: 27 июн 2017, 13:36
Решено: 119
Откуда: Нижний Тагил
Благодарил (а): 716 раз
Поблагодарили: 1816 раз
Контактная информация:

Запуск программы

#8

25 сен 2017, 20:52

java -jar file.jar находясь в папке с файлом

Изображение

Изображение


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск программы

#9

25 сен 2017, 21:05

нет не сработало.
БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ


Аватара пользователя

rogoznik

Сообщения: 9443
Зарегистрирован: 27 июн 2017, 13:36
Решено: 119
Откуда: Нижний Тагил
Благодарил (а): 716 раз
Поблагодарили: 1816 раз
Контактная информация:

Запуск программы

#10

25 сен 2017, 21:07

tortik писал(а): нет не сработало.

подробнее пожалуйста. Вывод из терминал вместе с командой которую набрал покажи

Изображение

Изображение


no avatar

symon2014

Запуск программы

#11

25 сен 2017, 21:09

sudo java -jar ~/Downloads/cXPBootstrap-1.1.0-SNAPSHOT-production.jar
так попробуй


Аватара пользователя

Chocobo

Сообщения: 9954
Зарегистрирован: 27 авг 2016, 22:57
Решено: 214
Откуда: НН
Благодарил (а): 795 раз
Поблагодарили: 2980 раз
Контактная информация:

Запуск программы

#12

25 сен 2017, 21:12

А с чем мы хоть дело кстати имеем?

tortik, Покажи еще и java -version

Изображение

   

Изображение


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск программы

#13

25 сен 2017, 21:53

Symon2014:не сработало. БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ
Сhocobo:
java version «1.8.0_144»
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) Server VM (build 25.144-b01, mixed mode)

А с чем мы хоть дело кстати имеем?

думаю разницы не будет, но что именно сказать? приложение официальное


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск программы

#14

25 сен 2017, 21:58

darkfenix: sudo java -jar файл.jar


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск программы

#15

25 сен 2017, 22:23

Всем большое спасибо отвечу завтра


Аватара пользователя

di_mok

Сообщения: 5440
Зарегистрирован: 27 авг 2016, 19:06
Решено: 32
Откуда: Арзамас
Благодарил (а): 1569 раз
Поблагодарили: 1263 раза
Контактная информация:

Запуск программы

#16

26 сен 2017, 01:00

tortik, проблема таится в том, что ты запускаешь из сеанса суперпользователя. Просто запусти от обычного пользователя sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar и всё заработает

Настоящая водка — это не пьянство, а ключ к своей совести, с нее-то и начинается настоящая мудрость. (c)
Изображение


Аватара пользователя

rogoznik

Сообщения: 9443
Зарегистрирован: 27 июн 2017, 13:36
Решено: 119
Откуда: Нижний Тагил
Благодарил (а): 716 раз
Поблагодарили: 1816 раз
Контактная информация:

Запуск программы

#17

26 сен 2017, 09:04

tortik писал(а): darkfenix: sudo java -jar файл.jar

А что в ответ получил?

Изображение

Изображение


no avatar

tortik

Сообщения: 9
Зарегистрирован: 25 сен 2017, 18:42
Благодарил (а): 8 раз
Контактная информация:

Запуск .jar-файла

#18

26 сен 2017, 18:32

darkfeni:
ubuntu-HP-Compaq-8100-Elite-CMT-PCubuntu # sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar
Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar
di_mok: вот ответ терминала:

Код: Выделить всё

ubuntu@ubuntu-HP-Compaq-8100-Elite-CMT-PC ~ $ sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar
[sudo] пароль для ubuntu: 
Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar

БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!


Аватара пользователя

Chocobo

Сообщения: 9954
Зарегистрирован: 27 авг 2016, 22:57
Решено: 214
Откуда: НН
Благодарил (а): 795 раз
Поблагодарили: 2980 раз
Контактная информация:

Запуск .jar-файла

#19

26 сен 2017, 18:37

Я конечно не спец в java, но нагуглил тут хелловорлд, для проверки

Код: Выделить всё

chocobo@lmde:~/java$ ls -l
итого 12
-rw-r--r-- 1 chocobo chocobo 426 сен 26 18:02 HelloWorld.class
-rw-r--r-- 1 chocobo chocobo 779 сен 26 18:03 HelloWorld.jar
-rw-r--r-- 1 chocobo chocobo 117 сен 26 18:02 HelloWorld.java
chocobo@lmde:~/java$ java -jar HelloWorld.jar 
Hello World!

tortik, Вот здесь ты запускаешь его из домашнего раздела. А сам файлик именно там и лежит?
покажи ls -l ~/cXPBootstrap-1.1.0-SNAPSHOT-production.jar

Изображение

   

Изображение


Аватара пользователя

rogoznik

Сообщения: 9443
Зарегистрирован: 27 июн 2017, 13:36
Решено: 119
Откуда: Нижний Тагил
Благодарил (а): 716 раз
Поблагодарили: 1816 раз
Контактная информация:

Запуск .jar-файла

#20

26 сен 2017, 19:08

Chocobo, тут спецом в java и не надо быть.
Судя по этому:

tortik писал(а): Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar

у меня подозрения на отсутствие вообще каких-либо прав доступа к этому файлу.

Изображение

Изображение


Вернуться в «Иное программное обеспечение»


Перейти

  • Новости
  • ↳   Новости Linux Mint
  • ↳   Другие новости
  • Документация, FaQ и Видеоматериалы
  • ↳   Руководства
  • ↳   Руководство пользователя LM 18 Cinnamon
  • ↳   Видеоматериалы
  • ↳   Вопрос новичка и FaQ
  • Установка, настройка, оптимизация
  • ↳   Установка Linux Mint
  • ↳   Загрузка системы, бэкапы и восстановление
  • ↳   Параметры и оптимизация
  • ↳   Иные системные ошибки
  • ↳   Неофициальные сборки
  • ↳   Общие вопросы по системе
  • Дистрибутивы
  • ↳   Linux Mint
  • ↳   Cinnamon
  • ↳   Mate
  • ↳   Xfce
  • ↳   KDE
  • ↳   Другие среды рабочего стола
  • ↳   LMDE
  • Программное обеспечение
  • ↳   Мультимедиа
  • ↳   Офис и документы
  • ↳   Системные утилиты
  • ↳   Консольные плюшки
  • ↳   Программирование, скриптинг, виртуализация
  • ↳   Работа с сетью
  • ↳   Безопасность
  • ↳   Wine
  • ↳   Игры
  • ↳   Иное программное обеспечение
  • Поддержка железа
  • ↳   Видеокарты
  • ↳   Звуковые карты
  • ↳   Принтеры, Сканеры, МФУ
  • ↳   Жесткие диски, SSD, Flash-накопители, разделы на них
  • ↳   Сетевые карты, модемы, Wi-Fi, bluetooth
  • ↳   Прочие устройства
  • Другие дистрибутивы
  • ↳   Deb-based [Debian / Neon / Ubuntu]
  • ↳   Arch-based [Arch / Manjaro / Antegros]
  • ↳   Rpm-based [Suse / Fedora / CentOS]
  • ↳   Прочие [Gentoo/Slackware/*BSD]
  • Разное
  • ↳   Болталка: Оффтоп, разбор полетов
  • ↳   Песочница
  • ↳   Корзина

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 0 гостей

  • MiniTool

  • MiniTool News Center

  • 4 Useful Methods to Fix the “Unable to Access Jarfile” Error

By Daisy | Follow |
Last Updated March 05, 2021

google search

A JAR is a package file format which is used by many Java class files with the associated metadata and resources to get packed in a single package for distribution. Sometimes, the “unable to access jarfile” error will occur when you open it. You can read this post from MiniTool to fix this error.

What Causes the “Unable to Access Jarfile” Error

There are several different reasons for the “Java unable to Access Jarfile” issue. Most of them are related to the handling of JAR files on your computer.

1. The latest Java version has not been installed on your computer.

2. The file path set for the Java executable is incorrect and points to the wrong location.

3. The default program for opening JAR files is not set.

4. Malware is on your computer.

Tip: You should ensure that you have an active internet connection and administrator account privileges before you move on to the methods.

How to Fix the “Unable to Access Jarfile” Error

  1. Install the Latest Java Version
  2. Set the Default File Association
  3. Check for Malware
  4. Check for Documentation (for Developers)

How to Fix the “Unable to Access Jarfile” Error

Method 1: Install the Latest Java Version

You need to install the proper architecture i.e. Java on your computer for programs to run JAR files. Furthermore, it should be the latest version released. Here is the tutorial.

Step 1: Press the Windows + R keys at the same time to open the Run dialogue box, then type appwiz.cpl and click OK to open the Programs and Features window.

Step 2: Then navigate to the entry of Java and right-click it, then click Uninstall.

Step 3: Then go to the official Java website and download the latest version. Run it to install the latest version of Java after you download the executable.

Restart your computer and check if the “Unable to Access Jarfile” error message has been resolved.

Method 2: Set the Default File Association

If you are still unable to access jarfile Minecraft, you can try changing the file association. Here are the steps.

Step 1: Navigate to the JAR file’s directory. Right-click it and select Open with and select the Java program.

Tip: If you do not get the option right away to open as Java, you can click Choose another app and select Java.

Step 2: Then press the Windows + I keys to launch the Settings application. Now navigate to Apps and select Default apps from the left navigation bar.

select Default apps from the left navigation bar

Step 3: Now click Choose default apps by file type present at the near bottom. Now locate the entry .jar file and make sure it is selected to be opened by Java.

Step 4: Then you should save changes and exit.

Restart your computer and check if the “unable to access jarfile” error message is resolved.

Method 3: Check for Malware

You should check if there is any virus or malware on your computer if you are still receiving the error when you start your operating system or any program.

You should run a thorough check on your computer and then follow method 1 to ensure all the entries and file associations are deleted and then remade when you reinstall Java. Here is how to remove malware after you check, read this post — How To Remove Malware From A Windows Laptop.

Method 4: Check for Documentation (for Developers)

If you are a developer coding with Java or other languages, you also encounter this error message when you try to start a JAR file. This can be really troublesome and will probably halt your task at hand.

It is recommended that you read the documentation for the function or utility that opens or runs the JAR file to diagnose and solve the error. You may have mistaken the file path, or you may have passed the wrong parameter to the function.

Final Words

You can know the reasons for the “Java unable to Access Jarfile” issue and 4 useful methods that can fix the error from this post. I really hope that this post can help you.

About The Author

Daisy

Position: Columnist

She was graduated from the major in English. She has been the MiniTool editor since she was graduated from university. She specializes in writing articles about backing up data & systems, cloning disks, and syncing files, etc. She is also good at writing articles about computer knowledge and computer issues. In daily life, she likes running and going to the amusement park with friends to play some exciting items.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Linux error occurred during initialization of vm java lang noclassdeffounderror java lang object
  • Linux error no such partition
  • Linux error device not found skipping fsck
  • Linux error could not find or load main class
  • Linux error cannot open file

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии