From: Richard Q. <ric...@gm...> - 2009-04-24 06:29:37
|
On Thu, Apr 23, 2009 at 5:21 PM, Joe Python <jop...@gm...> wrote: > > -----------------<cut here>----------------------------- > #!/usr/java/bin/java -jar /path/to/jython.jar This is interpreted as: /usr/java/bin/java "-jar /path/to/jython.jar" on Linux at least, and gives the following error: Unrecognized option: -jar /path/to/jython/jython.jar > The above shell script doesn't work and gives the following error message. > Exception in thread "main" java.util.zip.ZipException: error in opening zip Now I didn't expect *that* error message! > However the script runs fine if executed as follows. > $ /usr/java/bin/java -jar /path/to/jython.jar testgreeting.jy > > Can someone help me to fix the shebang in the above script. One solution if you want to use shebang is to use env and call the jython wrapper script (which is itself a shebang shell script). i.e. change the first line to this: #!/usr/bin/env /path/to/jython/jython You can skip /path/to/jython/ if that is expected to be in your PATH. There's a good explanation of all this on wikipedia http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Portability regards, Richard |