0

I wrote a little java program and now I want to execute this .jar file from a .sh script.

my script:

#! /bin/bash
java -jar /var/spool/sms/sentSMS.jar

then i run the command: sudo bash sentSMS.sh an get following error:

ERROR: Unable to access jarfile /var/spool/sms/sentSMS.jar

I am using a Raspberry with raspian-jessie, if this important to solve it.

Sorry, but I'm new in scripting with linux.

1 Answer 1

1

Take into account that the user must have at least READ permissions on that file. Also, as you say you are new in linux, make sure the name is correct. sentSMS.jar is different from sentsms.jar

Sign up to request clarification or add additional context in comments.

5 Comments

He's using sudo, so root needs read permission, not the user.
Correct @childofsoong !!
Hi, thanks. I used sudo chown pi /var/.. . For the jar and for the sh file. Is there a differense to read permission? Now pi is the owner or?
You can see the owner of the file with "ls -l <file_name>" . Anyway, check as well that the jar file is not corrupted. Just to make sure you have read permissions, execute "chmod 775 <file_name>"
Okay, I tried it but I had to do something else. Afer changing the script to: #! /bin/bash c=$(java -jar /var/spool/sms/sentSMS.jar) it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.