496N/A/*
2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
496N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
496N/A *
496N/A * This code is free software; you can redistribute it and/or modify it
496N/A * under the terms of the GNU General Public License version 2 only, as
496N/A * published by the Free Software Foundation.
496N/A *
496N/A * This code is distributed in the hope that it will be useful, but WITHOUT
496N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
496N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
496N/A * version 2 for more details (a copy is included in the LICENSE file that
496N/A * accompanied this code).
496N/A *
496N/A * You should have received a copy of the GNU General Public License version
496N/A * 2 along with this work; if not, write to the Free Software Foundation,
496N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
496N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
496N/A */
496N/A
496N/Aimport javax.script.*;
496N/A
496N/A/*
496N/A * If the JDK being tested is <b>not</b> a Sun product JDK and a js
496N/A * engine is not present, return an exit code of 2 to indicate that
496N/A * the jrunscript tests which assume a js engine can be vacuously
496N/A * passed.
496N/A */
496N/Apublic class CheckEngine {
496N/A public static void main(String... args) {
496N/A int exitCode = 0;
496N/A ScriptEngine engine =
496N/A (new ScriptEngineManager()).getEngineByName("js");
496N/A
496N/A if (engine == null &&
496N/A !(System.getProperty("java.runtime.name").startsWith("Java(TM)"))) {
496N/A exitCode = 2;
496N/A }
496N/A
496N/A System.exit(exitCode);
496N/A }
496N/A}