After exporting my project from Eclipse into an executable Java program, the program stops responding randomly. I can't find any specific event or action that causes it. The only reason I can think of it happening is an endless loop however the only one I have is this:
for(int i =0;i<pipes.length;i++){
if((powerUp.bound.overlaps(pipes[i].bounds)|| (powerUp.bound.overlaps(pipes[i].bounds2)))|| (powerUp.bound.overlaps(blocks[i].bound))){
powerUp.position.y=(float) ((HEIGHT/4)+((HEIGHT/2)* (Math.random())));
i=0;
}
}
Which basically makes sure the powerUp doesn't spawn within objects, there is plenty of free space for them to spawn in.
There are no other continuous loops in my code so are there other reasons for a "stopped responding" error?
You definitely need to figure out where the hang is occurring. Remember - it's entirely possibly it has nothing to do with the "for" loop: it could be anywhere.
It's a pretty safe bet the "hang" is an application error, not a "JVM bug".
SUGGESTIONS:
Execute your program in an IDE debugger (for example, Eclipse or Android Studio) and look at the threads/thread stacks when the "hang" occurs;
Alternatively, step through your program in the debugger until you encounter the hang.
Write "printf" or "toast" statements before/after your "for" loop to verify whether or not the "hang" actually occurs inside the loop;
Run strace, Windows Process Explorer or a similar OS-level tool to see the last thing your program did before it hung.
If you have any system and/or application logs, be sure to check them.
I have no idea what your target environment is. But on the off-chance it might be Android, this article might help.