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]