JNA support for aarch64.

768 views
Skip to first unread message

PJ

unread,
Aug 8, 2018, 6:58:01 PM8/8/18
to Java Native Access
Hello,

I have a Java application that runs fine on Windows as well as Linux (x86 and x64). I am currently trying to add support for it to run on the AARCH64 platform (the Jetson TX2 board). The application has built-in documentation that invokes a built-in browser. The application runs fine for the most part. However, when I try to access the embedded documentation via the built-in browser, I get a couple of Java errors as follows:


Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't obtain static method fromNative(Method, Object) from class com.sun.jna.Native
at com.sun.jna.Native.initIDs(Native Method)
at com.sun.jna.Native.<clinit>(Native.java:135)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent.getHandle(SWTNativeComponent.java:948)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent.createNativePeer(SWTNativeComponent.java:1006)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent.access$17(SWTNativeComponent.java:989)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$12.run(SWTNativeComponent.java:882)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at com.sun.jna.examples.unix.X11.<clinit>(X11.java:326)
at com.sun.jna.examples.WindowUtils$X11WindowUtils$6.run(WindowUtils.java:1647)
at com.sun.jna.examples.WindowUtils$NativeWindowUtils.whenDisplayable(WindowUtils.java:348)
at com.sun.jna.examples.WindowUtils$X11WindowUtils.setMask(WindowUtils.java:1675)
at com.sun.jna.examples.WindowUtils$NativeWindowUtils.setWindowMask(WindowUtils.java:602)
at com.sun.jna.examples.WindowUtils.setComponentMask(WindowUtils.java:1758)
at chrriis.dj.nativeswing.NativeComponentProxyPanel$EmbeddedPanel.applyShape(NativeComponentProxyPanel.java:347)
at chrriis.dj.nativeswing.NativeComponentProxyPanel.adjustEmbeddedPanelShape_(NativeComponentProxyPanel.java:211)
at chrriis.dj.nativeswing.NativeComponentProxyPanel.access$4(NativeComponentProxyPanel.java:195)
at chrriis.dj.nativeswing.NativeComponentProxyPanel$5.run(NativeComponentProxyPanel.java:188)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)</clinit></clinit>

I am working on resolving errors related to the DJNative libraries. However, can you please point me in the right direction as to why I might be running into the JNA-related errors that I have marked in bold above?  I am using the jna-3.4.0.jar that I obtained here: http://www.java2s.com/Code/Jar/j/Downloadjna340jar.htm. The original version is jna-3.2.4.jar, which fails as well, but with a slightly different error that starts off like this:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't obtain static method dispose from class com.sun.jna.Native

I could replace the libjnidispatch.so inside the jna-3.2.4.jar with the aarch64-specific version that I found here: https://github.com/java-native-access/jna/tree/master/dist.  

What I could also do is build the libjnidispatch.so on the aarch64. I did find a makefile, but I couldn't find the source or the instructions to build JNA on aarch64. 

Could you please advise? Thanks!

--
PJ


Matthias Bläsing

unread,
Aug 9, 2018, 3:01:40 PM8/9/18
to jna-...@googlegroups.com
Hi,

Am Mittwoch, den 08.08.2018, 15:58 -0700 schrieb PJ:
>
> I have a Java application that runs fine on Windows as well as Linux
> (x86 and x64). I am currently trying to add support for it to run on
> the AARCH64 platform (the Jetson TX2 board).
> [...]
> I am working on resolving errors related to the DJNative libraries.
> However, can you please point me in the right direction as to why I
> might be running into the JNA-related errors that I have marked in
> bold above? I am using the jna-3.4.0.jar that I obtained
> here: http://www.java2s.com/Code/Jar/j/Downloadjna340jar.htm. The
> original version is jna-3.2.4.jar, which fails as well, but with a
> slightly different error that starts off like this:
> Exception in thread "AWT-EventQueue-0"
> java.lang.UnsatisfiedLinkError: Can't obtain static method dispose
> from class com.sun.jna.Native
>
> I could replace the libjnidispatch.so inside the jna-3.2.4.jar
> with the aarch64-specific version that I found here: https://github.c
> om/java-native-access/jna/tree/master/dist.
>
> What I could also do is build the libjnidispatch.so on the aarch64. I
> did find a makefile, but I couldn't find the source or the
> instructions to build JNA on aarch64.

the native library and the java counter part of JNA are deeply
connected. In general you can't just use the native library from a
different version.

Please check if the library can move to JNA 4.5.2, which is the current
stable version. (native + java code!)

HTH

Matthias

Kasper Johansen

unread,
Aug 23, 2018, 4:09:53 AM8/23/18
to Java Native Access
Hi, 

I have had a similar problem with this JNA driver found on the TX2 board. I have found a workaround, but are still experiencing errors . when using ethernet. 
What I have done to get this working was to install the libjna-java package on that TX2 board, which is the one supported by Ubuntu 16.04 LTS. Vers -> 4.2.2-1. 
Then I have created a symlink in: "/usr/lib/jvm/java-8-oracle/jre/lib/aarch64", like so:  libjnidispatch.so -> /usr/lib/aarch64-linux-gnu/jni/libjnidispatch.system.so. "sudo ln -s /usr/lib/aarch64-linux-gnu/jni/libjnidispatch.system.so libjnidispatch.so" when being in the "/usr/lib/jvm/java-8-oracle/jre/lib/aarch64/" directory.
You need to fix the path according to your java version.

I hope this helps you getting your stuff running. 

What I experience is errors when accessing ethernet drivers etc. I get this error in the syslog: "[ 3678.114604] Unsupported IOCTL call". 
The os on the TX2 is this: Linux tegra-ubuntu 4.4.38-tegra #1 SMP PREEMPT Mon Apr 30 16:06:06 CEST 2018 aarch64 aarch64 aarch64 GNU/Linux

Br. 
Kasper
Reply all
Reply to author
Forward
0 new messages