• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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".
 
Mike De
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic