File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Mike De
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic