Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Run java shell script on Linux

paultaylorNov 11 2004 — edited Nov 15 2004
Hi I am just trying to convert a Windows batch file to a unix shell script to run a java application, but it so long since Ive used UNIX I cant really remember how to do it.

My script contains
#!/bin/sh
java  -jar lib/testapp.jar
These are my failed attempts to run it, not too sure what the differences are but I think the 3rd one is the only one to actually find my shell script.
[root@]# testapp.sh
-bash:  testapp.sh: command not found
[root@]# ./ testapp.sh
: bad interpreter: No such file or directory
[root@]# .  testapp.sh
Unable to access jarfile lib/testapp.jar
if I just do this at the command line it works fine
[root@]#java  -jar lib/testapp.jar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2004
Added on Nov 11 2004
8 comments
234 views