32 package eu.mihosoft.vrl.v3d.ext.openjfx.importers;
35 import java.net.MalformedURLException;
36 import java.net.URISyntaxException;
38 import java.net.URLClassLoader;
39 import java.util.ArrayList;
40 import java.util.List;
55 final URL url = referenceClass.getProtectionDomain().getCodeSource().getLocation();
59 File currentDir =
new File(url.toURI()).getParentFile();
60 libDir =
new File(currentDir,
"lib");
61 }
catch (URISyntaxException ue) {
63 throw new RuntimeException(
"Could not import library. Failed to determine library location. URL = " + url.getPath());
66 File[] files = libDir.listFiles();
67 final List<URL> urlList =
new ArrayList<>();
69 for (File file : files) {
71 urlList.add(file.toURI().toURL());
72 }
catch (MalformedURLException me) {
77 URLClassLoader cl =
new URLClassLoader((URL[]) urlList.toArray(
new URL[0]),
this.getClass().getClassLoader());
80 throw new RuntimeException(
"Could not import library. Failed to determine importer library location ");
URLClassLoader addUrlToClassPath()