From 76f8b4602c0631a11cc77a87130bbe3b698680af Mon Sep 17 00:00:00 2001 From: Gravit'a <12893402+gravit0@users.noreply.github.com> Date: Sat, 15 Apr 2023 17:40:34 +0700 Subject: [PATCH] [FIX] JAVA_HOME override --- .../launchermodules/LauncherModuleLoader.java | 11 ----------- .../pro/gravit/launcher/ClientLauncherWrapper.java | 9 +++++++-- modules | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java b/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java index 7b20a2d9..52580dc4 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java @@ -119,17 +119,6 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO ModuleEntity entity = new ModuleEntity(); entity.path = file; entity.moduleMainClass = mainClass; - try { - Class mainClazz = (Class) classLoader.loadClass(entity.moduleMainClass); - entity.checkResult = server.modulesManager.checkModuleClass(mainClazz); - } catch (Throwable e) { - if (e instanceof ClassNotFoundException || e instanceof NoClassDefFoundError) { - logger.error("Module-MainClass in module {} incorrect", file.toString()); - } else { - logger.error(e); - } - return super.visitFile(file, attrs); - } entity.moduleConfigClass = attributes.getValue("Module-Config-Class"); if (entity.moduleConfigClass != null) { entity.moduleConfigName = attributes.getValue("Module-Config-Name"); diff --git a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java index 6a0d2f29..4e35838e 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java +++ b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java @@ -141,8 +141,12 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep if (customJvmOptions != null) { args.addAll(customJvmOptions); } - args.add("-cp"); - args.add(String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath)); + if(context.useLegacyClasspathProperty) { + args.add(String.format("-Djava.class.path=%s", String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath))); + } else { + args.add("-cp"); + args.add(String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath)); + } args.add(context.mainClass); args.addAll(context.clientArgs); LogHelper.debug("Commandline: " + args); @@ -170,6 +174,7 @@ public static class ClientLauncherWrapperContext { public Path executePath; public String mainClass; public int memoryLimit; + public boolean useLegacyClasspathProperty; public ProcessBuilder processBuilder; public List args = new ArrayList<>(8); public Map jvmProperties = new HashMap<>(); diff --git a/modules b/modules index 29ee5c6d..8adf9de6 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 29ee5c6d804282bac17d526a185a41ee40ddd1da +Subproject commit 8adf9de6efe47bd820f756184f2a184e1d677dd8