是否可以使用Nashorn (the new JavaScript engine for Java8)与三个 Java 8 紧凑配置文件中的每一个一起吗?
请您参考如下方法:
是的,您可以在所有紧凑型配置文件中使用 Nashorn。这是明确记录的 in the compact profiles for embedded文档:
Compact1 Profile APIs
Similar to the legacy Connected Device Configuration (CDC) with the Foundation Profile, secure sockets layer (SSL), logging, and scripting language support, including Javascript. When configured with the minimal JVM, the compact1 profile APIs have a static footprint of about 12MB.
每个紧凑型配置文件都是前一个配置文件的超集,因此,由于可在紧凑型 1 中使用,Nashorn 也可在紧凑型 2 和紧凑型 3 中使用。
作为进一步的证据,错误 JDK-8027532已提交并解决,以确保 Nashorn 不会使用 Compact1 之外的任何类。
请注意,有 no requirement for JVMs to provide any particular script engine 。因此,虽然 Nashorn 与所有紧凑型配置文件兼容,但特定的 JVM 可能无法使其可用。