views:

28

answers:

1

I have a Rhino project where I've written some .js files, and from Eclipse I start my program by calling org.mozilla.javascript.tools.shell.Main with a parameter to one of my .js files, "src/bot.js". Now, in order to run this on my server I would like to be able to build it into a single runnable JAR for easy deployment. How do I do this, or should I try to take on a totally different approach?

A: 

The syntax to invoke a script is:

java org.mozilla.javascript.tools.shell.Main [options] script-filename-or-url [script-arguments]

I have not tried it but in threory you should be able to pass in JAR URL as indicated below:

The syntax of a JAR URL is:

jar:<url>!/{entry}  

for example:

jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class  
jar:file:/export/home/faculty/stansif/public_html/java/applets/image/view.jar!/image.gif  
Romain Hippeau
Okay, so if I want to be able to just double click my JAR file or enter ./myProgram.jar in a terminal to start my JavaScript code that won't be possible?
vrutberg
@vrutberg in the main that gets executed in the jar file then call the javascript main or create a batch file and wrap it.
Romain Hippeau