Java 8 Javascript Engine backwards compatibility

前端 未结 1 1619
遇见更好的自我
遇见更好的自我 2021-02-01 04:20

I am trying out Java 8 in my project and I am stuck in an error related to my build process.

I am using ANT scripts and at some point i am using some javascript (embeded

1条回答
  •  醉话见心
    2021-02-01 05:07

    One approach is to include

    load("nashorn:mozilla_compat.js");
    

    which supplies importClass.

    On the other hand, you can use java.io.File, java.io.FileReader, ... directly without importing.

    var File = java.io.File;
    var FileReader = java.io.FileReader;
    

    This is backward compatible with Rhino.

    0 讨论(0)
提交回复
热议问题