Reputation: 43
I have a string, srcCode, that contains
"HashSet hs = new HashSet();
int i=0;
for(i=0;i<10,i=i+2){
hs.add(i);
}"
using BeanShell interpret, am trying to interpret it, below is the code:
bsh.set("hs", hs);
bsh.eval("import java.lang.String;");
bsh.eval(srcCode);
its giving me error, "line 2 column 11 encountered EOF" Can that be acheived using the BeanShell interpreter?
Upvotes: 0
Views: 423
Reputation: 240956
fix for loop syntax, you are missing ;
for(i=0; i<10; i = i + 2) {
Upvotes: 1