diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/PojavClassLoader.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/PojavClassLoader.java index 386b4356..c39679ab 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/PojavClassLoader.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/PojavClassLoader.java @@ -1,6 +1,7 @@ package net.kdt.pojavlaunch; import java.io.File; +import java.io.IOException; import java.net.*; /** @@ -13,7 +14,7 @@ public class PojavClassLoader extends URLClassLoader { public PojavClassLoader(ClassLoader parent) { super(new URL[0], parent); } - + @Override public void addURL(URL url) { super.addURL(url); @@ -23,4 +24,30 @@ public class PojavClassLoader extends URLClassLoader { e.printStackTrace(); } } + + static URL getFileURL(File file) { + try { + file = file.getCanonicalFile(); + } catch (IOException e) {} + + try { + return file.toURL(); + } catch (MalformedURLException e) { + // Should never happen since we specify the protocol... + throw new InternalError(e); + } + } + + /** + * This class loader supports dynamic additions to the class path + * at runtime. + * + * @see java.lang.instrument.Instrumentation#appendToSystemClassPathSearch + */ + private void appendToClassPathForInstrumentation(String path) { + assert(Thread.holdsLock(this)); + + // addURL is a no-op if path already contains the URL + super.addURL(getFileURL(new File(path))); + } } \ No newline at end of file diff --git a/Natives/JavaLauncher.m b/Natives/JavaLauncher.m index 474711a1..50a8ea1c 100644 --- a/Natives/JavaLauncher.m +++ b/Natives/JavaLauncher.m @@ -674,7 +674,11 @@ int launchJVM(int argc, char *argv[]) { } margv[margc++] = cacio_classpath; } + } else if (!started) { + // Opens to ARC DNS + margv[margc++] = "--add-opens=java.base/java.net=ALL-UNNAMED"; } + if (!started) { init_loadCustomJvmFlags(); }