I'm attempting run a jar file, but am running into the "Unable to access jar file" error.

When I run it from the Windows path (I hope the term is right, am new to this), it runs fine:

java -jar /mnt/c/jars/filename.jar <parameter>

This runs without any issues.

I downloaded this jar into the Linux filesystem, using wget, into /home/username/jars. I checked, and the jar file is there. Now, when I run:

java -jar ~/jars/filename.jar <parameter>

I get an error, saying:

Error: Unable to access jarfile /home/username/jars/filename.jar

And I'm getting a similar error when i go into the jars directory and run the command:

java -jar filename.jar <parameter>

Any ideas as to what could be the problem?

From a suggestion in the comments, i ran:

ls -l ~/

and I got:

drwxrwxrwx 1 username username 512 Jan 28 11:29 jars
  • 1
    the jar file permission and owner? is it executable? – AtomiX84 Jan 28 at 11:46
  • yes, it's executable. I don't think its an issue with that – user3377812 Jan 28 at 12:01
  • The .jar file doesn't need to be executable when run with java; however, the path to the directory needs to be executable. So check the permissions of ~/jars. – Jos Jan 28 at 12:01
  • I did that. Got -rwxrwxrwx – user3377812 Jan 28 at 12:06
  • Are you sure? That doesn't look like a dictionary. – Jos Jan 28 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.