You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Jacques Granduel <jg...@gmail.com> on 2010/11/22 18:02:37 UTC

default Script Engines?

Hi again,

a side question...
The scripts in BXML are evaluated thru jsr-223,  so Javascript scripts are
evaluated by default with rhino-1.6R2 from the JVM, if I'm not wrong.
Server-side JS (and of course Pivot) is more attractive because of CommonJS
standard. Do you think of any clean mean of embedding a commonJS engine
(narwhaljs for ex.), or at least a very recent version of rhino to be used
from Pivot? Even project projects from https://scripting.dev.java.net/ don't
seem to be that actively maintained...

Regards,
jqg

Re: default Script Engines?

Posted by Sandro Martini <sa...@gmail.com>.
Hi,
I've never tried with the latest Rhino (1.7R2), from Mozilla ... and could
be an interesting test.
To embed another engine it must be compliant with JSR-223, and I don't know
if CommonJS is compliant (I wasn't aware of it), and this could be another
interesting test.

On Scripting subprojects, as you I think that most aren't actively
maintained, but because in many of them the scripting support classes are
already included in standard projects.

For example Groovy has in the standard distribution all the classes needed
to be JSR-223 compliant, so maybe even others ... take a look here:

http://groovy.codehaus.org/JSR+223+Scripting+with+Groovy
http://groovy.codehaus.org/api/groovy/util/GroovyScriptEngine.html

If you open the jar of groovy (for example the latest groovy-all-1.7.5.jar,
under the embeddable folder ... and maybe even the "normal" not embeddable
jar) you can find related classes inside.

and the same should be for JRuby, but again I haven't tried myself (maybe
others) ...


Some info on Scripting and Java 6 or later:
http://tim.oreilly.com/lpt/a/6560
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/


If you have more question, or if you have some result, write here ...

Bye,
Sandro

-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/default-Script-Engines-tp1947226p1947688.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: default Script Engines?

Posted by Greg Brown <gk...@mac.com>.
The only default script engine is the one that ships with the JDK. However, you can add JARs for any other script engine to make it available to your Pivot code. You just need to tell the page which language to use - for example:

<?language groovy?>

G

On Nov 22, 2010, at 12:02 PM, Jacques Granduel wrote:

> Hi again, 
> 
> a side question...
> The scripts in BXML are evaluated thru jsr-223,  so Javascript scripts are evaluated by default with rhino-1.6R2 from the JVM, if I'm not wrong.
> Server-side JS (and of course Pivot) is more attractive because of CommonJS standard. Do you think of any clean mean of embedding a commonJS engine (narwhaljs for ex.), or at least a very recent version of rhino to be used from Pivot? Even project projects from https://scripting.dev.java.net/ don't seem to be that actively maintained...
> 
> Regards, 
> jqg
>