You could do something like this, assuming that /home/j/pong/pong.jar/ Ball.js is the path to your JS file in your JAR and you have an instance of ScriptEngine:

ClassLoader classLoader = getClass().getClassLoader();
URL scriptLocation = classLoader.getResource("/home/j/pong/pong.jar/ Ball.js");

BufferedReader scriptReader = new BufferedReader(new InputStreamReader(scriptLocation.openStream()));
scriptEngine.eval(scriptReader);


On Jul 17, 2009, at 11:48 AM, Joseph Montanez wrote:

I am wondering if anyone know how to load js files after its been
jar'd.

So:
/home/j/:$ java -jar pong/pong.jar
load("Ball.js");

Tries to load from:
/home/j/Ball.js

I want it to load from:
/home/j/pong/pong.jar/Ball.js

Is that not possible?
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to