How can I start coding with Oracle's Nashorn JS Engine and when will it replace Rhino in the OpenJDK?

后端 未结 4 1698
既然无缘
既然无缘 2020-12-30 02:00

I\'m looking for a way to start playing around with Oracle\'s new Nashorn JavaScript Engine. I\'ve DL\'d the latest OpenJDK 8 (b65) and it appears that Rhino is still the on

4条回答
  •  太阳男子
    2020-12-30 02:38

    Install the JDK8 and create an alias for your JDK's jjs (Nashorn Interpreter), e.g., if you create a file called test.js, you can run the program with:

    $ jjs test.js
    

    Mac OS = alias jjs=’/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/bin/jjs’

    Windows = Define an environment variable called ‘JAVA8_HOME’ and point to your jdk8 folder, then you can invoke jjs by running this command:

    > “%JAVA8_HOME%\jre\bin\jjs” test.js
    

提交回复
热议问题