Recently I am trying to add some resource into a jar through java. By that I could insert some extern resource like songs when I launch the game. And then I learned about how to insert something into a jar through java. But it seems like we could just "override" a jar but not "insert". That's to say,we have to copy and paste whole jar file then add our files into it. And everytime we do it,we just create a new jar(although it could be totally containing the same content).
And then,I tried to set the insert stage to mod initalization phase. And first time I launch the game,It failed because the ClassnotDefExcetion,I guess that's because some .class files were overrided while running. But after this crash,every launching succeed and I just rerun it. So why it will always crash with ClassnotDefException at the first time but work peacefully after that and the mod just do what it did last time!!