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

JDK17+下jpackage生成的app-image启动多开exe问题咨询

Multiple Main.exe Processes Spawned on Windows 10 with jpackage-Generated Apps (JDK 17+)

I’ve dug into this exact issue, and it boils down to a deliberate change in how the jpackage Windows launcher works starting with JDK 17. Here’s what you need to know:

Reproducible Setup

First, the minimal Swing app that triggers the duplicate process:

import javax.swing.*;

public class Main {
    public static void main(String[] args) {
        JDialog dialog = new JDialog();
        dialog.setVisible(true);
    }
}

Packaged using this jpackage command:

jpackage --type app-image --input jpackage_test_jar --dest install/tmp --main-jar jpackage_test.jar --main-class Main

Behavior Breakdown by JDK Version

  • JDK 15 & 16: Only one Main.exe process shows up in Task Manager’s Details tab (the actual Java runtime running your app)
  • JDK 17, 18 & 19: Two Main.exe processes appear—this is intentional behavior now

Why This Happens

Starting in JDK 17, the Windows launcher for jpackage switched to a wrapper process pattern. The first Main.exe is a lightweight launcher that handles things like argument parsing, setting up the runtime environment, and then spawning the actual Java process (the second Main.exe) that runs your Swing application. This change was made to improve startup reliability and align with modern Windows application conventions.

Tested Environment

I’ve verified this across multiple JDK distributions:

  • JDK 15: AdoptOpenJDK
  • JDK 16–19: Eclipse Adoptium (Eclipse Temurin builds)

Workarounds (If Needed)

If you absolutely need a single process, you have a couple options:

  1. Package your app using JDK 16 (though this locks you out of JDK 17+ features)
  2. Check the OpenJDK Bug Tracker to see if there’s a flag or upcoming fix to disable the wrapper process (as of now, there’s no official toggle, but you can follow related discussions)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 16:15:57