Hullo Joseph, Thanks for showing us this alternative. I was not aware that you could do it this way.
If you want to be able to load the script from the classpath however, the example I submitted in the previous thread will do that for you, as long as the jar file is in the classpath. Regards, Bediako On Tue, Jul 21, 2009 at 11:55 PM, Joseph Montanez <[email protected]> wrote: > I was aiming for a pure javascript way of doing this. This is what I > have so far, I haven't had much luck using the context to load the > javascript so I just used eval. > > load.fromJar = function (jarFileName, jsFileName) { > var jar = new java.util.jar.JarFile(jarFileName); > var entry = jar.getJarEntry(jsFileName); > var input = jar.getInputStream(entry); > var stream = new java.io.InputStreamReader(input); > var buffer = new java.io.BufferedReader(stream); > var js = ''; > var line = ''; > while(line !== null) { > var line = buffer.readLine(); > js += line; > } > stream.close(); > return js; > } > > var lib = load.fromJar('../build/jar/runtime.jar', 'GameWindow.js'); > eval(lib); > > On Jul 17, 3:48 pm, Joseph Montanez <[email protected]> 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 > -- Bediako George Partner - Lucid Technics, LLC Think Clearly, Think Lucid (p) 202.683.7486 (f) 703.563.6279 _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
