Skip to content

Commit 84bd9ec

Browse files
committed
Core: Try to load native libs smartly.
1 parent 912db88 commit 84bd9ec

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/main/java/dev/webview/webview_java/WebviewNative.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ private static WebviewNative runSetup() {
8383
}
8484

8585
try {
86+
// Copy it to a file.
8687
InputStream in = WebviewNative.class.getResourceAsStream(lib.toLowerCase());
8788
byte[] bytes = StreamUtil.toBytes(in);
8889
Files.write(target.toPath(), bytes);
@@ -92,6 +93,8 @@ private static WebviewNative runSetup() {
9293
System.err.println("Unable to extract native: " + lib);
9394
throw e;
9495
}
96+
97+
System.load(target.getAbsolutePath()); // Load it. This is so Native will be able to link it.
9598
}
9699

97100
return Native.load("webview", WebviewNative.class);

0 commit comments

Comments
 (0)