hi, Cameron McCormack

     thanks for replay!

coz i have arguments with the javascript file, like as ex1.js arg1(ex2.js arg2), how can i cat those js files.

thanks.


"Cameron McCormack" <[email protected]> wrote in message news:[email protected]...
Hi Peggy.

peggy wrote:
    i use bash shell to call js using rhino.

ex:
java -jar ../path/to/js.jar ex1.js $*
java -jar ../path/to/js.jar ex2.js $*
java -jar ../path/to/js.jar ex3.js $*

    ex1,ex2,ex3 are different javacript project and excute easy script(
like as only print for test). must it write many times [java -jar
../path/to/js.jar ] ? it is very slowly to start java to excute ex1(2,3).js
everytime.
coz it will let %cpu high to start java everytime.

The JS shell can evaluate multiple files:

$ java -jar js.jar -help
Usage: java org.mozilla.javascript.tools.shell.Main [options...] [files]
Valid options are:
    -?, -help          Displays help messages.
    -w                 Enable warnings.
    -version 100|110|120|130|140|150|160|170
                       Set a specific language version.
    -opt [-1|0-9]      Set optimization level.
    -f script-filename Execute script file, or "-" for interactive.
    -e script-source   Evaluate inline script.
    -debug             Generate debug code.
    -strict            Enable strict mode warnings.
    -fatal-warnings    Treat warnings as errors.
-encoding charset Use specified character encoding as default when reading scripts.
$ cat a.js
print("hello")
$ cat b.js
print("there")
$ java -jar js.jar -f a.js -f b.js
hello
there

Although the usage information says "[files]" at the end, it seems you can only list a single file (if you don't use the "-f" option like above).

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

Reply via email to