1

嗨,我有简单的代码:

import gnu.io.CommPortIdentifier;
import java.util.Enumeration;

public class test
{

    public static void main(String[] args)
    {   
        Enumeration pList = CommPortIdentifier.getPortIdentifiers();
        while (pList.hasMoreElements()) {
          CommPortIdentifier cpi = (CommPortIdentifier) pList.nextElement();
          System.out.print("Port " + cpi.getName() + " ");
        }
    }

}

我已经安装了他们在这里写的库

我得到这样的错误

java.lang.ClassCastException: gnu.io.RXTXCommDriver cannot be cast to gnu.io.CommDriver thrown while loading gnu.io.RXTXCommDriver

怎么了 ??我在 ubuntu 上工作。

4

0 回答 0