How to fix (Access is denied)

Earlier my impression was that (Access is denied) comes when you try to read a text or binary file for which you don't have permission from Java program but this can also come while you are using jar command. jar command internally use class to open any jar or war file which can throw (Access is denied). I was trying to see contents of war file which was created using recent build when I stumble upon this error, see the exact command below:

test@dev454:war-store/target jar -tvf maven-eclipse-web-demo maven-eclipse-web-demo (Access is denied)
        at Method)

Possible cause of (Access is denied):

Here are some of the possible cause I checked immediately:

1) See if you have permission to read jar file or not

this is the most obvious reason of (Access is denied) exception and I didn't had sufficient permission so I immediately provided read, write and execute permission to war file and tried again
but it didn't help it was still throwing that exception.

And, If you are new to Java world then I also recommend you go through The Complete Java MasterClass on Udemy to learn Java in a better and more structured way. This is one of the best and up-to-date courses to learn Java online.

2) See if some other process is using that file

This could be another possible reason of " (Access is denied)". in my case I had earlier tried "tar" command to read that file which I suspect hasn't released the file. because after few try it was solved.


How to fix (Access is denied) (Access is denied) obviously show something is wrong with file permissions. if you have sufficient file permission than possible reason both in Windows and Unix is might be some other process is using that file which may prevent jar command to list down contents of war file or extract content of war file. By the way if you are not aware of how to see contents of war file than its good to know that jar file can be used to see contents of both .jar and .war file. I haven't tested .ear file but I am sure jar command can extract that as well because they are kind of zip file.

Further Learning
Complete Java Masterclass
Java Fundamentals: The Java Language
Java In-Depth: Become a Complete Java Engineer!

Other Java troubleshooting tutorial you may like

1 comment :

Unknown said...


EN este archivo .- C:\Users\cjimenez.DGSGIF\AppData\Roaming\JDeveloper\system12.\DefaultDomain\bin

Post a Comment