ClassLoader (String argsPath, PrintStream err) { final List<URL> urls = new ArrayList<>(); try { //noinspection IOResourceOpenedButNotSafelyClosed BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(argsPath), StandardCharsets.UTF_8)); String classpath = reader.readLine(); for (String s : classpath.split(File.pathSeparator)) { urls.add(new File(s).toURI().toURL()); } reader.close(); } catch (IOException e) { e.printStackTrace(err); return null; } try { Class<?> classLoaderClass = Class.forName("com.intellij.util.lang.java6.UrlClassLoader"); return (ClassLoader)classLoaderClass.getMethod("create", List.class).invoke(null, urls); } catch (Throwable t) { t.printStackTrace(err); return null; } }