Unable to access jarfile
Solution 1:
Right click on the file and select Copy.
Now, say you are executing the file using this in the directory with the file in:
java -jar ./settask.jar
Type the beginning of the command (java -jar
), and then paste -Ctrl +Shift+V - you should end up with something like this, where is specifies the full path to the file:
java -jar file:///home/wilf/settask/settask.jar
Remove the file://
and press ↵:
java -jar /home/wilf/settask/settask.jar
If it works, then the same command should work in your script.
I hope this answer is OK, I think you are asking about bash scripts.
N.B:
./
tells it the command to search the directory it is currently in.
Havingfile://
at the beginning means it won't work.
Solution 2:
I ran into Unable to access jarfile
when trying to start a Spring Boot SysVinit service.
It turned out the directory and content in /srv/myapp/
had wrong ownership.
Running sudo sh -c "chown -R myapp:myapp /srv/myapp/ && chmod -R u=rx,g=,o= /srv/myapp"
gave all relevant files and directories correct ownership and permissions.