Search code examples
javawindowswindows-7portabilityrxtx

Problems with RXTX in Windows 7, but not in Windows 8


I'm working on a project which uses RXTX. I export it as an exacutable jar and it is in a folder like:

MainFolder
 - lib
   - RXTXcomm.jar
   - ... more jars
 - logs
 - config.properties
 - App.jar             <-- Executable jar

In my computer (Windows 8.1) works perfectly, but it has to work on others (Windows 7) too. Where the program stops in at this method:

public void getPortIdentifiers() {
    if(testMode) {
        // TODO puertos.elements();

    } else {
        if(Controller.debug) logger.info("Obteniendo identificadores... ");
        //identificadores = CommPortIdentifier.getPortIdentifiers();
        for(int i=0; i<15; i++) {
            String commPort = "COM"+i;
            try {
                CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(commPort);
                logger.info("Puerto {} OK", commPort);
            } catch (NoSuchPortException e) {
                logger.error("Puerto {} FAIL", commPort);
            }
        }       
        
        if(Controller.debug) logger.info("... Listo!");
    }
}

The program stoped at CommPortIdentifier.getPortIdentifiers(), reading this question made me try with the for listing all posible ports. But at my log I've allways the same:

...

2015-05-14 12:56:59 [INFO ] Controller - Cargando los puertos

2015-05-14 12:56:59 [INFO ] CommunicationManager - Obteniendo identificadores...

At the question before, darkhelmet said that the problem was solved rebuilding it on Windows 7. But mine has to work on Windows 8 and Windows 7, must I have two workspaces one in each?


Solution

  • At the end I could test it on other Windows 8 and it didn't work too. With this W8 I had two problems 1. Other java version. 2. Doesn't had the rxtxSerial64.dll.

    To make it compatible with more java versions I rebuild my project with jdk6 (just in case :D).

    And for the second problem I just put the rxtxSerial.dll and the rxtxSerial64.dll on the folder, at the level of my App.jar.

    With the Windows7 computer the problem was just the second, because both computer had the same jre version.

    I hope it helps others