Skip to content

Commit

Permalink
Merge pull request #1067 from matthiasblaesing/openjdk_aix_1066
Browse files Browse the repository at this point in the history
Use correct native library on OpenJDK on AIX
  • Loading branch information
matthiasblaesing authored Feb 16, 2019
2 parents e0d5537 + 017c8e1 commit a32e517
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Bug Fixes
---------
* [#1052](https://github.com/java-native-access/jna/pull/1052), [#1053](https://github.com/java-native-access/jna/issues/1053): WinXP compatibility for `c.s.j.p.win32.PdhUtil` - [@dbwiddis](https://github.com/dbwiddis).
* [#1055](https://github.com/java-native-access/jna/pull/1055): Include `c.s.j.p.linux` in OSGi bundle. - [@dbwiddis](https://github.com/dbwiddis).
* [#1066](https://github.com/java-native-access/jna/issues/1066): On AIX OpenJDK differs from IBM J9 in the mapping of library names. While J9 maps jnidispatch to `libjnidispatch.a`, OpenJDK maps to `libjnidispatch.so`, which causes the native library extractor to fail. AIX is now hard-coded to `libjnidispatch.a` - [@matthiasblaesing](https://github.com/matthiasblaesing).

Release 5.2.0
=============
Expand Down
8 changes: 7 additions & 1 deletion src/com/sun/jna/Native.java
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,13 @@ private static void loadNativeDispatchLibrary() {
*/
private static void loadNativeDispatchLibraryFromClasspath() {
try {
String libName = "/com/sun/jna/" + Platform.RESOURCE_PREFIX + "/" + System.mapLibraryName("jnidispatch").replace(".dylib", ".jnilib");
String mappedName = System.mapLibraryName("jnidispatch").replace(".dylib", ".jnilib");
if(Platform.isAIX()) {
// OpenJDK is reported to map to .so -- this works around the
// difference between J9 and OpenJDK
mappedName = "libjnidispatch.a";
}
String libName = "/com/sun/jna/" + Platform.RESOURCE_PREFIX + "/" + mappedName;
File lib = extractFromResourcePath(libName, Native.class.getClassLoader());
if (lib == null) {
if (lib == null) {
Expand Down

0 comments on commit a32e517

Please sign in to comment.