0

I have a dll file used to communicate with a card reader. In normal java project, I could load and use the library normally but when I try to use the same class in a Spring Boot project, the method does not seem to work.

The class looks like this:

public class cardfunction {

public native String GetDLLVersion();
static
{
    System.loadLibrary("DoorLock");
}

public native String CancelCard();
static
{
    System.loadLibrary("DoorLock");
}
}

These methods works fine but if I use this class in a Spring boot project, the dll is not working any more:

@RequestMapping("/")
public String home() {
    cardfunction fc = new cardfunction();
    int initialize = fc.initializeUSB();
    String dellVer = fc.GetDLLVersion();
    String hotelCode = fc.GetHotelSystemCode();
    fc.CloseUSB();
    return "initialize : " + initialize + " dllVer: " + dellVer + " hotelCode: " + hotelCode;
}

This is thrown:

java.lang.UnsatisfiedLinkError: com.hotel.card.cardfunction.initializeUSB()I
at com.hotel.card.cardfunction.initializeUSB(Native Method) ~[classes/:na]

enter image description here

D.T
  • 437
  • 8
  • 20
  • Check this solution: https://stackoverflow.com/questions/1403788/java-lang-unsatisfiedlinkerror-no-dll-in-java-library-path – Ilya Lysenko Feb 24 '20 at 18:57

0 Answers0