我想找到 Windows 7 中存在的端口,并且我已经为它编写了代码。它成功编译,但没有输出。我已经在 Netbeans 中编译
这是我的代码:
import java.util.*;
import javax.comm.*;
public class PortLister {
public static void main(String[] args) {
Enumeration e = CommPortIdentifier.getPortIdentifiers();
while (e.hasMoreElements()) {
System.out.println((CommPortIdentifier) e.nextElement());
}
}
}