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 @@ -27,8 +27,14 @@ private static SymbolLookup findLibrary(Arena arena) {
2727 try {
2828 var library = System .mapLibraryName ("tree-sitter" );
2929 return SymbolLookup .libraryLookup (library , arena );
30- } catch (IllegalArgumentException e ) {
31- return SymbolLookup .loaderLookup ();
30+ } catch (IllegalArgumentException ex1 ) {
31+ try {
32+ System .loadLibrary ("tree-sitter" );
33+ return SymbolLookup .loaderLookup ();
34+ } catch (UnsatisfiedLinkError ex2 ) {
35+ ex1 .addSuppressed (ex2 );
36+ throw ex1 ;
37+ }
3238 }
3339 }
3440}
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