summaryrefslogtreecommitdiffstats
path: root/libraries/launcher/org/multimc/Utils.java
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-09-27 04:04:19 +0200
committerPetr Mrázek <peterix@gmail.com>2017-09-27 04:04:19 +0200
commit464bc0f770880737597954fee8d48035b3274d6d (patch)
treeb58196730487ff1826b4dd542c797ea2f37e540f /libraries/launcher/org/multimc/Utils.java
parent0595a0009039abcfe68536e23c8a383c36000225 (diff)
downloadMultiMC-464bc0f770880737597954fee8d48035b3274d6d.tar
MultiMC-464bc0f770880737597954fee8d48035b3274d6d.tar.gz
MultiMC-464bc0f770880737597954fee8d48035b3274d6d.tar.lz
MultiMC-464bc0f770880737597954fee8d48035b3274d6d.tar.xz
MultiMC-464bc0f770880737597954fee8d48035b3274d6d.zip
GH-1997 replace use of weird hacks with normal java arguments
This affects classpath and java.library.path. The catch is that if the strings cannot be expressed in system codepage on Windows, it tries to use 8.3 paths.
Diffstat (limited to 'libraries/launcher/org/multimc/Utils.java')
-rw-r--r--libraries/launcher/org/multimc/Utils.java71
1 files changed, 0 insertions, 71 deletions
diff --git a/libraries/launcher/org/multimc/Utils.java b/libraries/launcher/org/multimc/Utils.java
index 860c0864..94b2eaa9 100644
--- a/libraries/launcher/org/multimc/Utils.java
+++ b/libraries/launcher/org/multimc/Utils.java
@@ -68,77 +68,6 @@ public class Utils
}
/**
- * Adds the specified library to the classpath
- *
- * @param s the path to add
- * @throws Exception
- */
- public static void addToClassPath(String s) throws Exception
- {
- File f = new File(s);
- URL u = f.toURI().toURL();
- URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
- Class urlClass = URLClassLoader.class;
- Method method = urlClass.getDeclaredMethod("addURL", new Class[]{URL.class});
- method.setAccessible(true);
- method.invoke(urlClassLoader, new Object[]{u});
- }
-
- /**
- * Adds many libraries to the classpath
- *
- * @param jars the paths to add
- */
- public static boolean addToClassPath(List<String> jars)
- {
- boolean pure = true;
- // initialize the class path
- for (String jar : jars)
- {
- try
- {
- Utils.addToClassPath(jar);
- } catch (Exception e)
- {
- System.err.println("Unable to load: " + jar);
- e.printStackTrace(System.err);
- pure = false;
- }
- }
- return pure;
- }
-
- /**
- * Adds the specified path to the java library path
- *
- * @param pathToAdd the path to add
- * @throws Exception
- */
- @Deprecated
- public static void addLibraryPath(String pathToAdd) throws Exception
- {
- final Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths");
- usrPathsField.setAccessible(true);
-
- //get array of paths
- final String[] paths = (String[]) usrPathsField.get(null);
-
- //check if the path to add is already present
- for (String path : paths)
- {
- if (path.equals(pathToAdd))
- {
- return;
- }
- }
-
- //add the new path
- final String[] newPaths = Arrays.copyOf(paths, paths.length + 1);
- newPaths[newPaths.length - 1] = pathToAdd;
- usrPathsField.set(null, newPaths);
- }
-
- /**
* Finds a field that looks like a Minecraft base folder in a supplied class
*
* @param mc the class to scan