views:

71

answers:

3

I found that Java 6 includes Rhino JS (except for one or two minor pieces), as javax.script. Pretty cool!

Does a Java 6 install (JRE or JDK, either) contain a binary that I can simply point to a .js file to run? (I think it would be great to be able to provide source code for others to read and run, without compilation, and require only that Java be installed.) Or do I have to build the little 8-line program in the docs?

+4  A: 

Yes, There's jrunscript

nos
Ah, I must have been looking in the JRE folder by mistake -- it's only in the JDK. Good enough for me. Thanks!
Ken
A: 

On my machine, I have a console application called js and I have all my js files begin with:

#/usr/bin/js

and set the script to executable. This is how I run mine.

kzh
A: 

There's a binary included in the JDK called jrunscript:

wookie@hoth:/usr/local/java/bin$ ./jrunscript 
js> println("This is hello from test.js");
This is hello from test.js
Jon