Det var denne jeg fik i en modificeret SimpleRead-java:
Exception in thread "main" java.lang.VerifyError:
(class: gnu/io/RXTXPort$SerialOutputStream, method: flush signature: ()V)
Illegal use of nonvirtual function call
at gnu.io.RXTXPort.<init>(RXTXPort.java)
at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java)
at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:634)
at SimpleRead.main(SimpleRead.java:31)
løsningen er:
$ java -noverify SimpleRead (se howto
http://wass.homelinux.net/howtos/Comm_How-To.shtml)
Jeg lavede en ny. som kører uden -noverify (?!):
import java.io.*;
import java.util.*;
import javax.comm.*;
public class PortTest
{
public static void main(String[] args)
{
CommPortIdentifier portId;
Enumeration portList;
InputStream inputStream;
SerialPort serialPort;
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements())
{
portId = (CommPortIdentifier) portList.nextElement();
System.out.println("Found port: "+portId.getName());
}
}
}
$ java PortTest
Found port: /dev/ttyS0
Found port: /dev/usb/ttyUSB0