Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,29 @@ public void loadLibraryRelative(String name) {
usrPaths = tokens;
}
String libname = System.mapLibraryName(name);
if (sysPath != null && loadLibrary0(new File(sysPath, libname), false)) {
if (sysPath != null && loadLibraryFromPath(sysPath, libname)) {
return;
}
for (String path : usrPaths) {
File libpath = new File(path, libname);
if (loadLibrary0(libpath, false)) {
return;
}
File altpath = Target_jdk_internal_loader_ClassLoaderHelper.mapAlternativeName(libpath);
if (altpath != null && loadLibrary0(altpath, false)) {
if (loadLibraryFromPath(path, libname)) {
return;
}
}
throw new UnsatisfiedLinkError("no " + name + " in java.library.path");
}

private boolean loadLibraryFromPath(String path, String libname) {
File libpath = new File(path, libname);
if (loadLibrary0(libpath, false)) {
return true;
}
File altpath = Target_jdk_internal_loader_ClassLoaderHelper.mapAlternativeName(libpath);
if (altpath != null && loadLibrary0(altpath, false)) {
return true;
}
return false;
}

/** Returns the directory containing the native image, or {@code null}. */
@NeverInline("Reads the return address.")
private static String getImageDirectory() {
Expand Down