UnsatisfiedLinkError java error on Windows

The free CAN Software API (Application Programming Interface) for Windows®
Locked
davide.marinucci
Posts: 2
Joined: Wed 27. Nov 2024, 16:22

UnsatisfiedLinkError java error on Windows

Post by davide.marinucci » Wed 27. Nov 2024, 17:25

Dear All,

I am trying to use the PCA Basic API, Java version, with a PCAN-USB device. I successfully used the API a couple of year ago but now it doesn't work anymore after I replaced my laptop with a brand new one.

Some details about the environment:
  • OS: Windows 10 Pro x64
  • PCAN-USB firmware: 8.6
  • PCAN-USB driver: 4.4.1.16693
  • PCAN-Basic API: 4.8.0.830
When running the old code with above environment, I am no able to look for device and got below error:

Code: Select all

java.lang.UnsatisfiedLinkError: 'boolean peak.can.basic.PCANBasic.initializeAPI()
Then I have downloaded again the PCAN-Basic API Linux (v4.9.0.7 this time), built the java example and run it but I got two different errors:
  • [ERROR1] Failed to load PCANBasic/PCANBasic_JNI DLLs
  • Then I renamed the DLL file into system32 directory by adding the "_jni" suffix and I got new error [ERROR2]: UnsatisfiedLinkError (same as above)
I had a look at the forum history but still getting the issue. It seems linked to the JNI but do not really know how to fix it. Can you please support me?

Thank you

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: UnsatisfiedLinkError java error on Windows

Post by F.Vergnaud » Thu 28. Nov 2024, 09:33

Hello,

If I understand correctly you have tried to rename PCANBasic.dll to PCANBasic_JNI.dll.
Be careful, PCANBasic.dll and PCANBasic_JNI.dll are 2 disctinct DLLs.

You need to have both PCANBasic.dll and PCANBasic_JNI.dll present in your working directory (or in your PATH).
By default, PCANBasic.dll is installed along with the PCAN drivers in Windows\System32.
You'll find both DLLs located in the PCANBasic package in "Samples\Samples.zip\GUI\JAVA\64-bit" (or 32-bit if you use Java 32-bit).
Best regards,
Fabrice

davide.marinucci
Posts: 2
Joined: Wed 27. Nov 2024, 16:22

Re: UnsatisfiedLinkError java error on Windows

Post by davide.marinucci » Fri 29. Nov 2024, 08:21

I completely missed that ZIP file into the PCANBasic ZIP file. :lol:
That fixed the issue... thank you for your support!

Locked