My question is pretty similar to How can I load a local file from embedded Rhino?.
Most of the suggestions I've have read suggested modifying java code, but I'm using Rhino that's embedded in vendor software (both Shibboleth and NetIQ IDM), so I don't have access to context in which Rhino exists (or the code that creates it), only the script engine that's been spawned in that context.
Corderer suggested doing something like...
eval("" + Packages.org.apache.commons.io.FileUtils.readFileToString(
new java.io.File("/the/local/root", "script.js");
));
...which works! Like Corderer, though, I was hoping for a less ugly solution (maybe actually being able to use load()). Is eval()
the best / easiest option to do this?
Liam