我使用JPOS库。我正在尝试使用RXTXCommDriver类获取所有串口的列表。调用主要的本机方法时会发生错误,该方法会获取所有端口的列表。
java.lang.UnsatisfiedLinkError:javax.comm.RXTXCommDriver.nativeGetVersion()Ljava / lang / String;
public class RXTXCommDriver implements CommDriver
{
private final static boolean debug = true;
private final static boolean devel = false;
private final static boolean noVersionOutput = "true".equals( System.getProperty( "gnu.io.rxtx.NoVersionOutput" ) );
static
{
if(debug ) System.out.println("RXTXCommDriver {}");
System.loadLibrary( "rxtxSerial" );
/*
Perform a crude check to make sure people don't mix
versions of the Jar and native lib
Mixing the libs can create a nightmare.
It could be possible to move this over to RXTXVersion
but All we want to do is warn people when first loading
the Library.
*/
String JarVersion = RXTXVersion.getVersion();
String LibVersion;
try {
LibVersion = RXTXVersion.nativeGetVersion();
} catch ( Error UnsatisfiedLinkError )
{
// for rxtx prior to 2.1.7
LibVersion = nativeGetVersion();
}
if ( devel )
{
if ( ! noVersionOutput )
{
System.out.println("Stable Library");
System.out.println("=========================================");
System.out.println("Native lib Version = " + LibVersion );
System.out.println("Java lib Version = " + JarVersion );
}
}