Java Reference
In-Depth Information
12.8 + 15.2 = 28.0
-90.0 - -10.5 = -79.5
5 * 12 = 60.0
56.0 / -7.0 = -8.0
num1 + num2 = 30.0
num1 + num2 = 90.0
10 + num1 = 80.0
Result of C:\jkscript.txt = 190.0
Summary
You can implement a script engine using the Java Script API. You will need to provide
the implementation for the ScriptEngine and the ScriptEngineFactory interfaces. You
need to package your script engine code in a certain way, so the engine can be discovered
by the ScriptManager at runtime. The JAR file for the engine should contain a file named
META-INF\services\javax.script.ScriptEngineFactory that should contain the fully
qualified names of all script engine factory classes; the Java Script API discovers those
script engine factories automatically. Once you package and deploy the script engine
code, you can access it the same way you have been accessing Nashorn and
other script engines.
 
Search WWH ::




Custom Search