Thanks to stunning foresight on the part of Sun </sarcasm> loading files
via File and InputStreamReader etc is incompatible with fetching files
from the JAR which your class lives in.
At the same time, Sun's recommended distribution method for java apps
(webstart) encourages (forces?) everything be in JAR's.
So, loading BSH scripts in that situation is not fun.
The typical code to get an IS for loading a file from *ANY* of the JAR's
that the current app is using (i.e. were in it's Class-Path manifest
attribute, and it has either downloaded or found locally) is very simple:
InputStream result =
this.getClass().getClassLoader().getResourceAsStream( "file.bsh" );
It seems that source() doesn't currently attempt this? IIRC from looking
at the bsh source on CVS bsh is actually using InputStream's internally
when parsing stuff anyway - in which case, it would be perhaps much
easier for the source() method to do something like:
1. use it's current approach
2. ...if it can't find the file, fallback to using the above code to
try and get an InputStream automatically from the environment.