It was fine with previous EJS/java version.
The problem can be solved if you add the following lines at the top of the initialize page

x=new double[n];
y=new double[n];
vx=new double[n];
vy=new double[n];