blob: 4fac53fb27eccfad0ef21f1fa5e8ec8e680e3021 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import java.util.Enumeration;
import gnu.io.CommPortIdentifier;
public class MyClass {
public static void main(String... args) {
Enumeration ports = CommPortIdentifier.getPortIdentifiers();
while (ports.hasMoreElements()) {
CommPortIdentifier port = (CommPortIdentifier) ports.nextElement();
System.out.println(port.getName());
}
}
}
|