I think you end up creating JavaApplication1 objects all the time which cause the stackOverflow exception. You should remove the line with the comment.
App2 a2 = new App2();
JavaApplication1 ja =new JavaApplication1(); //why do you need this?
public void run(){