You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Maven JavaFX项目如何配置jdk.tls.maxCertificateChainLength JVM参数

你需要根据你常用的启动方式,对应修改pom.xml中的插件配置:

1. 使用mvn javafx:run启动的配置方案

在javafx-maven-plugin的全局<configuration>节点下新增<options>配置,添加JVM参数,修改后的插件配置如下:

<plugin>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>0.0.6</version>
    <configuration>
        <mainClass>opn.greenwebs.webviewexample.App</mainClass>
        <!-- 新增JVM参数配置,所有执行场景(默认启动、调试、性能分析)都会继承该参数 -->
        <options>
            <option>-Djdk.tls.maxCertificateChainLength=15</option>
        </options>
    </configuration>
    <!-- 原有executions节点内容无需修改 -->
</plugin>

2. 使用mvn exec:java启动的配置方案

在exec-maven-plugin的<arguments>列表中,主类参数之前添加JVM参数,修改后的配置如下:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <configuration>
        <executable>java</executable>
        <arguments>
            <argument>--module-path</argument>
            <modulepath/>
            <argument>-classpath</argument>
            <classpath/>
            <!-- 新增JVM参数 -->
            <argument>-Djdk.tls.maxCertificateChainLength=15</argument>
            <argument>opn.greenwebs.webviewexample.App</argument>  
        </arguments>
    </configuration>
</plugin>

3. 打包后独立运行的配置

如果将项目打包后单独启动,直接在启动命令中加入该JVM参数即可,示例:

java -Djdk.tls.maxCertificateChainLength=15 --module-path 你的JavaFX库路径 --add-modules 所需模块 -jar 你的打包文件.jar

内容的提问来源于stack exchange,提问作者Brian Green

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 20:39:02