I used a shell script to run a Java class. My script contains
#!/bin/sh
java -jar jobs/job.jar
These are my failed attempts to run it.
[root@]#sh testapp.sh
Unable to access jarfile jobs/job.jar
if I just do this at the command line it works fine
[root@]#java -jar jobs/job.jar
thanks.
The best way is to get the current dirname and get in there with this:
#!/bin/sh
cd `dirname "$0"`
java -jar ./job/job.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With