Look here USB Detection (Threads forum at JavaRanch) . You may have to tweak it some and add the public static void main part in. It should give you something to go on.