title: Java : Audio capture device listing using Java Media Framework
body: <pre><code>import javax.media.*;
  import java.util.*;
  
  public class ListCaptureDevices {
  
      public static void main(String[] args) {
  
          Vector info = CaptureDeviceManager.getDeviceList(null);
          if (info == null)
              System.out.println("No Capture devices known to JMF");
          else {
              System.out.println("The following " + info.size()
                      + " capture devices are known to the JMF");
              for (int i = 0; i &lt; info.size(); i++)
                  System.out
                          .println("\t" + (CaptureDeviceInfo) info.elementAt(i));
          }
      }
  }
  </code></pre>
  
  <p>Above is the code to list the capture devices. It does not return <code>null</code> vector but still it print the size of the vector as <code>0</code> and says no devices are found. What is wrong with this code?</p>