用jUSB试试看,http://jusb.sourceforge.net/
举例:
import usb.core.*;
public class ListUSB
{
public static void main(String[] args)
{
try
{
Host host = HostFactory.getHost();
Bus[] bus = host.getBusses();
int total_bus = bus.length;
for (int i=0; i
{
Device root = bus[i].getRootHub();
int total_port = root.getNumPorts();
for (int j=1; j<=total_port; j++)
{
Device device = root.getChild(j);
if (device != null)
{
// 操作USB
}
}
}
} catch (Exception e)
{
System.out.println(e.getMessage());
}
}