The JDJ article states that BPP encodes literals as calls to the beanshell print() statement, so
#x=3; y=4;
$x*$y=$(x*y)
becomes
x=3;y=4;
print(""+x+"*"+y+"="+(x*y));
It turns out that using this statement complicated several things: output redirection, character encoding, and template creation. The latest encoding convention is to turn these into more traditional java println statements:
BPP automatically assigns out to the proper stream, but you must do this yourself if you want to execute the generated script outside of BPP. The simplest would be to add
#out=System.out;
as the first part of the script. This allows for flexibility and adherence to correct java code with the least amount of changes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The JDJ article states that BPP encodes literals as calls to the beanshell print() statement, so
#x=3; y=4;
$x*$y=$(x*y)
becomes
x=3;y=4;
print(""+x+"*"+y+"="+(x*y));
It turns out that using this statement complicated several things: output redirection, character encoding, and template creation. The latest encoding convention is to turn these into more traditional java println statements:
x=3;y=4;
out.print(x);out.print("*");out.print(y);out.print("=");out.println(x+y);
BPP automatically assigns out to the proper stream, but you must do this yourself if you want to execute the generated script outside of BPP. The simplest would be to add
#out=System.out;
as the first part of the script. This allows for flexibility and adherence to correct java code with the least amount of changes.