#2755 Call Fantom interpreter from Java - Embedded Fantom

Ilove:= Sun 16 Jun

I means something like Nashorn or Rhino js engine. But in this case the Fantom script engine :)

https://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/

Ilove:= Sun 16 Jun

If it's possible it will be very cool. What do you think, devs? :)

andy Thu 20 Jun

We used to have some integration for Rhino/Nashorn -- but it was clear this was not a very well maintained project -- and increasingly had parity problems with modern browser js engines.

This is why we switched over to using NodeJs a few years ago. So its more of an "either-or" now.

Ilove:= Thu 20 Jun

No, you misunderstood me andy. I want to embedded fan script into Java code like the way rhino or nashorn do with js. Ex: call fantom script engine to execute a block of fantom code inside java code. I think it will be cool but don't think it's important. Anyway I could use buildjardist and let java import my generated jar.

Ex: FanEngine f = new FanEngine; f.execute("echo("hi")");

andy Fri 21 Jun

Ah yes -- I see -- shouldn't be too hard. Biggest issue is probably just getting the Fantom env setup so it can find all the pods -- might be cool to have a nice API for that.

Poke around here:

https://bitbucket.org/fantom/fan-1.0/src/default/src/sys/java/fanx/tools/Fan.java

And to see how we actually boot up Fantom:

https://bitbucket.org/fantom/fan-1.0/src/default/bin/fanlaunch

Login or Signup to reply.