Home

Back

Contents

Next

Executable scripts under Unix

You can use BeanShell for writing scripts as you would any other shell under Unix:

#!/usr/java/bin/java bsh.Interpreter 

print("foo");

#!/bin/sh
#! The following hack allows java to reside anywhere in the PATH.
//bin/sh -c "exec java bsh.Interpreter $0 $*"; exit

print("foo");

OSX

For OSX the path is a bit different:

#!/Library/Java/home/bin/java bsh.Interpreter.

print("foo");

On OSX /usr/bin/java is itself a shell script, which unfortunately won't work out-of-the-box.

Home

Back

Contents

Next