The error seems to originate from a bug in the java source code relating to the file chooser, so not something I have coded. Here you can see the bug in some versions of openjdk (a java implementation).
You must be registered to see the links
Why this happens to you, I'm not sure, as I haven't spent much time trying to understand exactly when this happens, but it's a rare bug.
My suggestion is to move the game folder to say C:\ in case there is some issue with folder names.
If that doesn't work, I wonder if you perhaps have your own java implementation installed, like the openjdk in the link with this bug. The game supplies its own java source code, but if you have a java version installed on your system, the game might possibly use that one instead. If that's the case, you could uninstall java from your system -- if you don't need it for something else -- and see if that fixes the problem.