13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 import javax.script.*;
24
25 /**
26 * Helper class to consolidate testing requirements for a js engine.
27 * A js engine is required as part of Oracle's product JDK.
28 */
29 public class Helper {
30 private Helper() {}; // Don't instantiate
31
32 public static ScriptEngine getJsEngine(ScriptEngineManager m) {
33 ScriptEngine e = m.getEngineByName("nashorn");
34 if (e == null &&
35 System.getProperty("java.runtime.name").startsWith("Java(TM)")) {
36 // A js engine is requied for Sun's product JDK
37 throw new RuntimeException("no js engine found");
38 }
39 return e;
40 }
41 }
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 import javax.script.*;
24
25 /**
26 * Helper class to consolidate testing requirements for a js engine.
27 * A js engine is required as part of Oracle's product JDK.
28 */
29 public class Helper {
30 private Helper() {}; // Don't instantiate
31
32 public static ScriptEngine getJsEngine(ScriptEngineManager m) {
33 return m.getEngineByName("nashorn");
34 }
35 }
|