When I export my Java game with embedded JRE the game can not more read Cyrillic strings from external files

63 views Asked by At

I try to export my videogame as executable with an embedded Java. When I launch the videogame from the IDE (Intellij IDEa) it works normally with external Cyrillic text files. But when I export it - It can not more read Cyrillic data files.

My Gradle build script:

task packageMyApp(type: io.github.fvarrui.javapackager.gradle.PackageTask, dependsOn: build) {        
    mainClass = mainClassName
    bundleJre = true
    generateInstaller = false
    administratorRequired = false
    platform = "windows"        
}

What can be wrong? Should I manual change the JRE which will be integrated in the game build? I have also tried to use JPackage. After creation of the executable distribution I have the same trouble. enter image description here

1

There are 1 answers

0
Vampire On BEST ANSWER

When reading your data files, make sure that you are specifying the encoding in which to read the files. If you use methods that could take an encoding but do not specify one, then up to Java 17 the system default encoding is used, which can be UTF-8 but can also be something else. It might be the case that when launching through the IDE the system encoding is overwritten to be UTF-8 and that it works due to that.