Cosa non funziona? Riesci a trovare le porte seriali e parallele del PC?
Prova il seguente codice e dimmi se ti restituisce qualche output, ovvero se trova le porte seriali del tuo PC.
Ovviamente assicurati di:
[list=1][*]Aggiungere il comm.jar al classpath[*]Aggiungere la win32com.dll nella cartella <jre>/bin[*]Aggiungere il javax.comm.properties nella cartella <jre>/lib[/list=1]
codice:
import javax.comm.*;
/**
*
SimpleRead modificata</p>
*
Copyright: Copyright (c) 2005</p>
*
* @author Eumene
* @version 1.0
*/
public class ShowPort {
static CommPortIdentifier portId;
static Enumeration portList;
public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
System.out.println("Found port: " + portId.getName() + " " + portId.getPortType());
}
}
}
Fammi sapere.
Ciao