Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try loading the library with System.loadLibrary() #96

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/kenai/jffi/internal/StubLoader.java
Expand Up @@ -295,6 +295,7 @@ public StubLoader() {}
static void load() {
final String libName = getStubLibraryName();
List<Throwable> errors = new ArrayList<Throwable>();

String bootPath = getBootPath();
if (bootPath != null && loadFromBootPath(libName, bootPath, errors)) {
return;
Expand Down Expand Up @@ -335,6 +336,14 @@ static void load() {
}
}

// Try to JVM's library path
try {
System.loadLibrary(libName);
return;
} catch (Throwable t1) {
errors.add(t1);
}

// aggregate error output and rethrow
if (!errors.isEmpty()) {
Collections.reverse(errors);
Expand Down