Animation in .j3o model

I’ve come into a strange problem. I have a model with a number of animations. My program plays back recorded animations, so in the log file I record the animation index of the .j3o model i.e.:

Object[] o = control.getAnimationNames().toArray();

If I want to then record the animation, I can simply record the index number of the array of animations.

public int getAnimationState(String animationName){
    for(int i = 0; i < o.length; i++){
       String s = o[i].toString();
           return i;
    return 0;

Similarly, if I want to play back the animation, I can easily read the index number and retrieve the name of the animation:

public String getAnimationName(int state){
    if(o.length >= state){
        return o[state].toString();
    return "";

This worked perfectly in the IDE. However, when I tried to create a distributable, the indices of the collection of animations are not the same.

Is this normal behavior and is there any way to handle this in the release version?


It seens to be java problem not Jm3 problem, I could not see any Jmonkey class in this your custom solution…
Talking about java, if you dont put any specific order in the array, it may happen, try to sort it.