File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
main/java/org/purejava/appindicator
test/java/org/purejava/appindicator Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ final class RuntimeHelper {
30
30
private static final String LD_CONFIG = "/etc/ld.so.conf.d/" ;
31
31
private static final String LIB_NAME_VERSION = "libappindicator3.so.1" ;
32
32
private static final String FLATPAK_LIB_NAME_VERSION = "libappindicator3.so" ;
33
+ private static final String LIBNAME_WITH_VERSION = "appindicator3" ;
33
34
private static List <String > allPath = new LinkedList <>();
34
35
private static final Logger LOG = LoggerFactory .getLogger (RuntimeHelper .class );
35
36
@@ -64,6 +65,14 @@ final class RuntimeHelper {
64
65
break ;
65
66
} catch (UnsatisfiedLinkError ignored ) { }
66
67
}
68
+
69
+ // When loading via System.load wasn't successfull, try to load via System.loadLibrary
70
+ if (!isLoaded ) {
71
+ try {
72
+ System .loadLibrary (LIBNAME_WITH_VERSION );
73
+ isLoaded = true ;
74
+ } catch (UnsatisfiedLinkError ignored ) { }
75
+ }
67
76
LOG .info (isLoaded ? "Native code library libappindicator3 successfully loaded" : "Native code library libappindicator3 failed to load" );
68
77
SymbolLookup loaderLookup = SymbolLookup .loaderLookup ();
69
78
SYMBOL_LOOKUP = name -> loaderLookup .find (name ).or (() -> LINKER .defaultLookup ().find (name ));
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ class AppIndicatorTest {
22
22
private static final String LD_CONFIG = "/etc/ld.so.conf.d/" ;
23
23
private static final String LIB_NAME_VERSION = "libappindicator3.so.1" ;
24
24
private static final String FLATPAK_LIB_NAME_VERSION = "libappindicator3.so" ;
25
+ private static final String LIBNAME_WITH_VERSION = "appindicator3" ;
25
26
private static List <String > allPath = new LinkedList <>();
26
27
27
28
@ Test
@@ -56,6 +57,14 @@ public void shouldHaveNoErrors() {
56
57
break ;
57
58
} catch (UnsatisfiedLinkError ignored ) { }
58
59
}
60
+
61
+ // When loading via System.load wasn't successfull, try to load via System.loadLibrary
62
+ if (!isLoaded ) {
63
+ try {
64
+ System .loadLibrary (LIBNAME_WITH_VERSION );
65
+ isLoaded = true ;
66
+ } catch (UnsatisfiedLinkError ignored ) { }
67
+ }
59
68
LOG .info (isLoaded ? "Native code library libappindicator3 successfully loaded" : "Native code library libappindicator3 failed to load" );
60
69
}
61
70
}
You can’t perform that action at this time.
0 commit comments