RXTX nicht Liste finden oder ports unter windows 7 64 bit

Guten morgen,

Habe ich Probleme mit/oder Installation der rxtx auf windows 7 64 bit. Ich arbeitete mit ihm vorher auf einem x86 win XP system und hatte keine Probleme. Seit der Neuinstallation auf dieses neue system aus irgendeinem Grund rxtx nicht in der Lage ist zu suchen Sie nach allen ports zu löschen. Ich habe versucht, die rxtx installieren, Cloud Hoppers 64-bit-native-Bibliothek und löschen Sie alle rxtx-Dateien und von vorne anfangen. RXTXcomm.jar ist gefunden und ich kann durchsuchen Sie die Pakete in NetBeans, aber die Umsetzung scheint kaputt zu sein oder wurde nicht gefunden.

Diese Zeile schlägt fehl beim ausführen jedes mal :

comPort = "COM1";
portId = CommPortIdentifier.getPortIdentifier(comPort);

und wirft einen NoSuchPortException.

Auflistung der seriellen ports, die über diese nichts produziert.

Enumeration ports = CommPortIdentifier.getPortIdentifiers();
String portArray[] = null;
while (ports.hasMoreElements()) {
    CommPortIdentifier port = (CommPortIdentifier) ports.nextElement();
    System.out.println(port.getName());
} 

Ich habe die seriellen Schnittstellen sind verfügbar, so dass an dieser Stelle Frage ich mich, ob die nativen Bibliotheken sind einfach gebrochen für windows 7 64 bit.

Hat jemand erfolgreich verwendet RXTX-2.2pre2 unter windows 7 64 bit?

Fehlerhaften code-Abschnitt im Konstruktor :

public SerialControl(String name, String comPort, int baudrate, int databits, String     parity, double stopbits) throws Exception {
    int stop = 0;
    int data = 0;
    int par = 0;

    this.name=name;

    //Sanity checks and interpretation
    if (baudrate > 115200 || baudrate < 300) {
        System.err.println(name+": constructor(): Invalid baudrate "+baudrate);
        throw new Exception("Invalid baudrate, " + baudrate);
    }

    if (databits >= 5 && databits <= 8) {
        switch (databits) {
            case 5:
                data = SerialPort.DATABITS_5;
                break;
            case 6:
                data = SerialPort.DATABITS_6;
                break;
            case 7:
                data = SerialPort.DATABITS_7;
                break;
            case 8:
                data = SerialPort.DATABITS_8;
                break;
            default:
                System.err.println(name+": constructor(): Invalid data bits, switched " + databits);
                throw new Exception("Invalid data bits, switched " + databits);
        }
    } else {
        throw new Exception("Invalid data bits=" + databits);
    }

    if (stopbits >= 1.0 && stopbits <= 2.0) {

        if (stopbits == 1.0) {
            stop = SerialPort.STOPBITS_1;
        } else if (stopbits == 1.5) {
            stop = SerialPort.STOPBITS_1_5;
        } else if (stopbits == 2.0) {
            stop = SerialPort.STOPBITS_2;
        } else {
            System.err.println(name+": constructor(): Invalid stop bits, switched " + stopbits);
            throw new Exception("Invalid stop bits, switched " + stopbits);
        }
    } else {
        System.err.println(name+": constructor(): Invalid stop bits, switched " + stopbits);
        throw new Exception("Invalid stop bits " + stopbits);
    }

    switch (parity) {
        case "S":
            par = SerialPort.PARITY_SPACE;
            break;
        case "E":
            par = SerialPort.PARITY_EVEN;
            break;
        case "M":
            par = SerialPort.PARITY_MARK;
            break;
        case "O":
            par = SerialPort.PARITY_ODD;
            break;
        case "N":
            par = SerialPort.PARITY_NONE;
            break;
        default:
            System.err.println(name+": constructor(): Invalid parity, switched " + parity);
            throw new Exception("Invalid parity, switched " + parity);
    }

    //Inits
    //Try to find the port specified
    try {
        portId = CommPortIdentifier.getPortIdentifier(comPort);
    } catch (Exception e) {
        System.err.println(name+": constructor(): No such port \"" + comPort+"\"");
        e.printStackTrace();
        throw e;
    }

    //Open the port
    try {
        serialPort = (SerialPort) portId.open("User Port", 2000);
    } catch (PortInUseException e) {
        System.err.println(name+": constructor(): Could not open port " + comPort);
        throw e;
    }

    //Grab the input stream
    try {
        inputStream = serialPort.getInputStream();
    } catch (IOException e) {
        System.err.println(name+": constructor(): Could not get input stream for " + comPort);
        throw e;
    }

    //Set the serial port parameters, no flow control
    try {
        serialPort.setSerialPortParams(baudrate, data, stop, par);
        serialPort.setDTR(false);
        serialPort.setRTS(false);
    } catch (UnsupportedCommOperationException e) {
        System.err.println(name+": constructor(): Error initializing " + comPort);
        throw e;
    }
}
  • beide SerialControl und CommPortIdentifier#getPortIdentifiers()` funktioniert aus Eclipse und die Kommandozeile
  • Ein kleiner Nachtrag für Leute, die auftreten können, diese, meine Projekte importiert wurden, von einer windows XP-Umgebung, die Wiederherstellung in Windows 7 zu haben scheinen, korrigiert, was immer das problem war.
InformationsquelleAutor darkhelmet | 2012-08-29
Schreibe einen Kommentar