diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java
index 83623c86d0..ef84614a2d 100644
--- a/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java
+++ b/HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java
@@ -24,7 +24,9 @@
import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.JarUtils;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
+import org.jackhuang.hmcl.util.platform.WineDetector;
+import javax.swing.*;
import java.io.IOException;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -46,9 +48,11 @@ public static void main(String[] args) {
System.getProperties().putIfAbsent("javafx.autoproxy.disable", "true");
System.getProperties().putIfAbsent("http.agent", "HMCL/" + Metadata.VERSION);
- createHMCLDirectories();
LOG.start(Metadata.HMCL_CURRENT_DIRECTORY.resolve("logs"));
+ checkWine();
+
+ createHMCLDirectories();
setupJavaFXVMOptions();
if (OperatingSystem.CURRENT_OS == OperatingSystem.MACOS) {
@@ -223,6 +227,20 @@ private static void verifyJavaFX() {
}
}
+ private static void checkWine() {
+ if (WineDetector.IN_WINE) {
+ SwingUtils.initLookAndFeel();
+ LOG.warning("HMCL is running under Wine or its distributions!");
+
+ int result = JOptionPane.showOptionDialog(null, i18n("fatal.wine_warning"), i18n("message.warning"), JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.WARNING_MESSAGE, null, null, null);
+
+ if (result == JOptionPane.CANCEL_OPTION) {
+ exit(1);
+ }
+ }
+ }
+
private static void addEnableNativeAccess() {
if (JavaRuntime.CURRENT_VERSION > 21) {
try {
diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties
index 2f682895b8..e0bf005d36 100644
--- a/HMCL/src/main/resources/assets/lang/I18N.properties
+++ b/HMCL/src/main/resources/assets/lang/I18N.properties
@@ -459,6 +459,7 @@ fatal.unsupported_platform.windows_arm64=Hello Minecraft! Launcher has provided
\n\
If you are using the Qualcomm platform, you may need to install the OpenGL Compatibility Pack before playing games.\n\
Click the link to navigate to the Microsoft Store and install the compatibility pack.
+fatal.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.
file=File
diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties
index 94b50e0302..8101f42cf6 100644
--- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties
+++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties
@@ -420,6 +420,7 @@ fatal.unsupported_platform=Minecraft 尚未對您的平臺提供完善支援,
fatal.unsupported_platform.loongarch=Hello Minecraft! Launcher 已為龍芯提供支援。\n如果遇到問題,你可以點擊右上角幫助按鈕進行求助。
fatal.unsupported_platform.macos_arm64=Hello Minecraft! Launcher 已為 Apple Silicon 平臺提供支援。使用 ARM 原生 Java 啟動遊戲以獲得更流暢的遊戲體驗。\n如果你在遊戲中遭遇問題,使用 x86-64 架構的 Java 啟動遊戲可能有更好的相容性。
fatal.unsupported_platform.windows_arm64=Hello Minecraft! Launcher 已為 Windows on Arm 平臺提供原生支援。如果你在遊戲中遭遇問題,請嘗試使用 x86 架構的 Java 啟動遊戲。\n\n如果你正在使用高通平臺,你可能需要安裝 OpenGL 相容包後才能進行遊戲。點擊連結前往 Microsoft Store 安裝相容包。
+fatal.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其衍生版本執行 HMCL。\nHMCL 是跨平臺的,我們建議您直接在主機系統上執行。\n按下「確定」以繼續,但請注意,此操作可能會引發一些問題。
file=檔案
diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
index c85d174044..8d83b13d15 100644
--- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
+++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
@@ -424,6 +424,7 @@ fatal.unsupported_platform=Minecraft 尚未对你的平台提供完善支持,
fatal.unsupported_platform.loongarch=Hello Minecraft! Launcher 已为龙芯提供支持。\n如果遇到问题,你可以点击右上角帮助按钮进行求助。
fatal.unsupported_platform.macos_arm64=Hello Minecraft! Launcher 已为 Apple Silicon 平台提供支持。使用 ARM 原生 Java 启动游戏以获得更流畅的游戏体验。\n如果你在游戏中遇到问题,使用 x86-64 架构的 Java 启动游戏可能有更好的兼容性。\n如遇到问题,你可以点击右上角帮助按钮进行求助。
fatal.unsupported_platform.windows_arm64=Hello Minecraft! Launcher 已为 Windows on Arm 平台提供原生支持。如果你在游戏中遇到问题,请尝试使用 x86 架构的 Java 启动游戏。\n如果你正在使用 高通 平台,你可能需要安装 OpenGL 兼容包 后才能进行游戏。点击链接前往 Microsoft Store 安装兼容包。\n如遇到问题,你可以点击右上角帮助按钮进行求助。
+fatal.wine_warning=HMCL is running under Wine or one of its distributions.\nAs a cross-platform application, HMCL is best experienced natively on your host OS.\nPress "OK" to continue, but please note that some issues may arise.\n\n您目前正在使用 Wine 或其发行版运行 HMCL。\nHMCL 是跨平台的,我们建议您直接在宿主系统上运行。\n按下“确定”以继续,但请注意,此操作可能会引发一些问题。
file=文件
diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java
new file mode 100644
index 0000000000..69b9e0766f
--- /dev/null
+++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/WineDetector.java
@@ -0,0 +1,58 @@
+/*
+ * Hello Minecraft! Launcher
+ * Copyright (C) 2026 huangyuhui and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.jackhuang.hmcl.util.platform;
+
+public final class WineDetector {
+ public static final boolean IN_WINE = isRunningUnderWine();
+
+ private static boolean isRunningUnderWine() {
+ if (OperatingSystem.CURRENT_OS != OperatingSystem.WINDOWS) {
+ return false;
+ }
+
+ return checkWineRegistryKey() && checkWineEnv();
+ }
+
+ private static boolean checkWineRegistryKey() {
+ Process process = null;
+ try {
+ process = Runtime.getRuntime().exec(
+ new String[]{"reg", "query", "HKLM\\Software\\Wine"}
+ );
+ if (!process.waitFor(800, java.util.concurrent.TimeUnit.MILLISECONDS)) {
+ process.destroyForcibly();
+ return false;
+ }
+ return process.exitValue() == 0;
+ } catch (Exception e) {
+ return false;
+ } finally {
+ if (process != null && process.isAlive()) {
+ process.destroyForcibly();
+ }
+ }
+ }
+
+ private static boolean checkWineEnv() {
+ return System.getenv("WINEPREFIX") != null;
+ }
+
+ private WineDetector() {
+ }
+}