This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Where do I get java-engine.jar to make new ScriptEngineManager().getEngineByName( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Where do I get java-engine.jar to make new ScriptEngineManager().getEngineByName("java"); work" Watch "Where do I get java-engine.jar to make new ScriptEngineManager().getEngineByName("java"); work" New topic
Author

Where do I get java-engine.jar to make new ScriptEngineManager().getEngineByName("java"); work

Mike De
Greenhorn

Joined: Jan 05, 2010
Posts: 8
I'm trying to dynamically compile a class using the Scripting for Java API as outlined here:
http://blogs.sun.com/sundararajan/entry/dynamic_source_code_in_java
But it appears I do not have the Script Engine installed which executes Java.

When I run this:

The out put is this:
Available script engines:
-------------------------------------------
Language: ECMAScript
Engine: Mozilla Rhino
-------------------------------------------



And when I try to run the following:


After completion _myEngine ==null

So my Question is what do I need to install Download etc in order to use 'Java' as a Script Engine?

The post refers to a release candidate from 2006 called mustang, the link is no longer active. I've tried using JDK 1.6.13,JDK 1.6.18 and JDK 1.6.20 all with the same results as above. This leads me to Believe there is some Libray which I must include in order to execute java code in the scripting engine.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
Correct, stock Java 6 only comes with a JavaScript implementation of javax.scripting. See https://scripting.dev.java.net/ for how to install other script engines, including one for "java".


Ping & DNS - my free Android networking tools app
Mike De
Greenhorn

Joined: Jan 05, 2010
Posts: 8
Cool Thanks:
Thanks
Download jsr223-engines.zip form here: https://scripting.dev.java.net/servlets/ProjectDocumentList
gunzip/untar (or unzip) it in a directory, say $JSR223-ENGINES
here is one directory for each language for which jsr223 engine is available.
Under each directory, there is a README.TXT that has URL of the scripting language implementation. You have to download that under the lib sub-directory.

To make it work All I had to do was add the jar to my class path.
 
Don't get me started about those stupid light bulbs.
 
subject: Where do I get java-engine.jar to make new ScriptEngineManager().getEngineByName("java"); work
 
Similar Threads
Need help with Java Scripting API.
Three questions about Java Scripting API.
jython engine: implementation fails
maven: dependency not added to the classpath during runtime
Standalone JavaScript programs