diff --git a/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java b/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java
index 27e360c..f804db8 100644
--- a/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java
+++ b/launcher/bootstrap/src/main/java/me/sashegdev/zernmc/launcher/Bootstrap.java
@@ -47,8 +47,37 @@ public class Bootstrap {
return binDir.resolve(JAR_NAME);
}
+ private static Path resolveBaseDir() {
+ // 1) Стартуем от папки, где лежит сам .exe (для launch4j codeSource -> путь к exe).
+ Path exeDir = null;
+ try {
+ java.security.CodeSource cs = Bootstrap.class.getProtectionDomain().getCodeSource();
+ if (cs != null && cs.getLocation() != null) {
+ Path loc = Paths.get(cs.getLocation().toURI()).toAbsolutePath();
+ if (!Files.isDirectory(loc)) {
+ loc = loc.getParent(); // jar/exe -> его папка
+ }
+ exeDir = loc;
+ }
+ } catch (Exception ignored) {
+ }
+ if (exeDir != null) {
+ // exe в bin/ -> база родитель (lib/jre21/assets в корне)
+ Path parent = exeDir.getParent();
+ Path candidates[] = { exeDir, parent }; // порядок: корень дистрибутива, затем родитель
+ for (Path c : candidates) {
+ if (c == null) continue;
+ if (Files.exists(c.resolve("bin").resolve(JAR_NAME))) {
+ return c;
+ }
+ }
+ }
+ // 2) Fallback: текущая рабочая папка (старое поведение).
+ return Paths.get("").toAbsolutePath();
+ }
+
public static void main(String[] args) throws Exception {
- baseDir = Paths.get("").toAbsolutePath();
+ baseDir = resolveBaseDir();
binDir = baseDir.resolve("bin");
Files.createDirectories(binDir);
logDir = baseDir.resolve("logs");
diff --git a/launcher/launcher/pom.xml b/launcher/launcher/pom.xml
index 71df809..0427856 100644
--- a/launcher/launcher/pom.xml
+++ b/launcher/launcher/pom.xml
@@ -191,6 +191,7 @@
console
false
me.sashegdev.zernmc.launcher.Bootstrap
+ --cli
lib/jre21
21
@@ -208,6 +209,38 @@
+
+
+
+ l4j-cli-jfx
+ package
+
+ launch4j
+
+
+ ../../server/builds/zernmc-cli-jfx.exe
+ ../../server/builds/zernmc-bootstrap.jar
+ console
+ false
+ me.sashegdev.zernmc.launcher.Bootstrap
+ --jfx
+
+ lib/jre21
+ 21
+
+
+ ${project.version}.${hotfix}
+ ${project.version}.${hotfix}
+ ZernMC Launcher CLI + JFX
+ ${project.version}.${hotfix}
+ ${project.version}.${hotfix}
+ ZernMC CLI JFX
+ ZernMC
+ zernmc-cli-jfx
+ zernmc-cli-jfx.exe
+
+
+
@@ -271,6 +304,12 @@
+
+
+
+
@@ -279,6 +318,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
ZernMC Launcher
diff --git a/launcher/pom.xml b/launcher/pom.xml
index 5efa756..7550914 100644
--- a/launcher/pom.xml
+++ b/launcher/pom.xml
@@ -20,7 +20,7 @@
1.0.16
- 14
+ 15
21
21
UTF-8