[FIX] ServerWrapperSetup javaw.exe

This commit is contained in:
Gravita 2021-11-17 21:57:51 +07:00
parent 559f4f4de7
commit 81a94faaf6
2 changed files with 6 additions and 2 deletions

View file

@ -430,11 +430,15 @@ public static Path resolveIncremental(Path dir, String name, String extension) {
} }
public static Path resolveJavaBin(Path javaDir) { public static Path resolveJavaBin(Path javaDir) {
return resolveJavaBin(javaDir, false);
}
public static Path resolveJavaBin(Path javaDir, boolean isConsole) {
// Get Java binaries path // Get Java binaries path
Path javaBinDir = (javaDir == null ? JVM_DIR : javaDir).resolve("bin"); Path javaBinDir = (javaDir == null ? JVM_DIR : javaDir).resolve("bin");
// Verify has "javaw.exe" file // Verify has "javaw.exe" file
if (!LogHelper.isDebugEnabled()) { if (!isConsole && !LogHelper.isDebugEnabled()) {
Path javawExe = javaBinDir.resolve("javaw.exe"); Path javawExe = javaBinDir.resolve("javaw.exe");
if (isFile(javawExe)) if (isFile(javawExe))
return javawExe; return javawExe;

View file

@ -100,7 +100,7 @@ public void run() throws Exception {
writer.append("#!/bin/bash\n\n"); writer.append("#!/bin/bash\n\n");
} }
writer.append("\""); writer.append("\"");
writer.append(IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home"))).toAbsolutePath().toString()); writer.append(IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home")), true).toAbsolutePath().toString());
writer.append("\" "); writer.append("\" ");
if (mainClassName.contains("bungee")) { if (mainClassName.contains("bungee")) {
LogHelper.info("Found BungeeCord mainclass. Modules dir change to modules_srv"); LogHelper.info("Found BungeeCord mainclass. Modules dir change to modules_srv");