javafx 对话框中的错误字符

Wrong Characters on javafx dialog

我使用 JOptionPane.showInputDialogTextInputDialog 来获取这样的用户输入:

TextInputDialog dialog = new TextInputDialog();

dialog.setTitle("ورودی");
dialog.setHeaderText("لطفا شماره انبار را وارد کنید");
dialog.getDialogPane().setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);

Optional<String> anbarId = dialog.showAndWait();

anbarId.ifPresent(s ->
                {
                    if (!s.equals("")) {
                        anbarLabel.setText(s);
                    }
                }
        );

但是当我 运行 可执行 jar 文件时,它显示错误的字符: Wrong characters on dialog

我使用 maven 程序集插件来创建可执行 jar 文件这是我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ansar</groupId>
    <artifactId>Jeticket</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>9.2.1.jre8</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.ansar.application.Main</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>

最后我通过将我的 jre 版本更改为 1.8.271 并使用 'String.valueOf()'

解决了这个问题