Created
April 3, 2014 16:43
-
-
Save coudy/9958130 to your computer and use it in GitHub Desktop.
Runs Google's Octane Benchmark using JDK8's Nashorn engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package eu.coudy.nashorn; | |
import jdk.nashorn.api.scripting.NashornScriptEngine; | |
import javax.script.CompiledScript; | |
import javax.script.ScriptEngineManager; | |
import javax.script.ScriptException; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
// svn checkout http://octane-benchmark.googlecode.com/svn/trunk/ octane-benchmark | |
// ...and run in the octane-benchmark directory | |
public class OctaneBenchmarkNashorn { | |
public static void main(String[] args) { | |
NashornScriptEngine nashorn = (NashornScriptEngine) new ScriptEngineManager() | |
.getEngineByName("nashorn"); | |
try { | |
CompiledScript scr = nashorn.compile(new String(Files.readAllBytes( | |
Paths.get("run.js")))); | |
scr.eval(); | |
} catch (ScriptException | IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remove the line "package eu.coudy.nashorn;" or else you'll get Error: Could not find or load main class OctaneBenchmarkNashorn