Java and Javastript playing together


One of the features that came with Java 6 is this neat trick: You can have a Javascript runtime on your Java program. You feed it with Javascript code and you can get the value of the variables.

It looks great if you need to use some logic already encoded with Javascript and you need to include it in your Java program. No rewriting is needed then.

I've done a sample program to evalaute a simple arithmetic expression as the first command line parameter of this Java program.

Comments

Popular posts from this blog

VFD control with Arduino using RS485 link

How to get sinusoidal s-curve for a stepper motor

Importing OpenSCAD designs into Onshape