File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
src/main/java/io/github/treesitter/jtreesitter Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,14 @@ private static SymbolLookup findLibrary(Arena arena) {
2828 try {
2929 var library = System .mapLibraryName ("tree-sitter" );
3030 return SymbolLookup .libraryLookup (library , arena );
31- } catch (IllegalArgumentException e ) {
32- return SymbolLookup .loaderLookup ();
31+ } catch (IllegalArgumentException ex1 ) {
32+ try {
33+ System .loadLibrary ("tree-sitter" );
34+ return SymbolLookup .loaderLookup ();
35+ } catch (UnsatisfiedLinkError ex2 ) {
36+ ex1 .addSuppressed (ex2 );
37+ throw ex1 ;
38+ }
3339 }
3440 }
3541}
Original file line number Diff line number Diff line change 4343 * SymbolLookup.libraryLookup(String, Arena)}.
4444 * </li>
4545 * <li>
46- * The libraries can be loaded manually by calling
47- * {@link java.lang.System#loadLibrary(String) System.loadLibrary(String)},
48- * if the library is installed in {@systemProperty java.library.path},
49- * or {@link java.lang.System#load(String) System.load(String)}.
46+ * If the libraries are installed in {@systemProperty java.library.path} instead,
47+ * they will be loaded automatically by {@link java.lang.foreign.SymbolLookup#loaderLookup()
48+ * SymbolLookup.loaderLookup()}.
5049 * </li>
5150 * <li>
5251 * The libraries can be loaded manually by registering a custom implementation of
You can’t perform that action at this time.
0 commit comments