loops - Java Virtual Machine stops responding with no known reason -
after exporting project eclipse executable java program, program stops responding randomly. can't find specific event or action causes it. reason can think of happening endless loop 1 have this:
for(int =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 makes sure powerup doesn't spawn within objects, there plenty of free space them spawn in.
there no other continuous loops in code there other reasons "stopped responding" error?
you need figure out where hang occurring. remember - it's entirely possibly has nothing "for" loop: anywhere.
it's pretty safe bet "hang" application error, not "jvm bug".
suggestions:
execute program in ide debugger (for example, eclipse or android studio) , @ threads/thread stacks when "hang" occurs;
alternatively, step through program in debugger until encounter hang.
write "printf" or "toast" statements before/after "for" loop verify whether or not "hang" occurs inside loop;
run strace, windows process explorer or similar os-level tool see last thing program did before hung.
if have system and/or application logs, sure check them.
i have no idea target environment is. on off chance might android, article might help:
good luck - , please post find!
Comments
Post a Comment