I'm trying to get the PCAN Java API to work on Linux (Ubuntu 18) with a PCAN USB.
To do so, I downloaded the Peak Linux driver package and the API package(PCAN-Basic_Linux-4.3.1) and compiled + installed them according to the Readme. I installed the libpcanbasic first and then the libpcanbasic_jni, as explained in the Readme. All compilations + installations worked without errors.
The pcanview tool works fine, detects the PCAN and shows the CAN messages as expected. Therefore, the driver seems to be OK.
However, when I try to run any Java application which tries to use the PCAN, it fails because it doesn't find the JNI:
Code: Select all
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no PCANBasic_JNI in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
at java.base/java.lang.System.loadLibrary(System.java:1867)
at peak.can.basic.PCANBasic.<clinit>(PCANBasic.java:294)
at peak.can.Application.<init>(Application.java:48)
at peak.can.Application$164.run(Application.java:4637)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
In the makefile for libpcanbasic_jni, I tried to set the JAVA_HOME both to an Oracle Java11 and Java8 JDK. Both produce the same result.
Did I miss/overlook something?
Thanks,
Markus