Cubecam was a small project to allow access to a webcam stream using Java, in the end it required the use of the Java Media Framwork

The program takes an image from the webcam stream and saves it to the local file system. The source is included in the Jar file, and you might see that it is also possible to edit it to upload it to an FTP server. The main code for accessing a webcam using Java is as follows, this assumes a certain number of imports, see source code (unzip the Jar file) for details.

          setLayout(new BorderLayout());
          setSize(640, 1100);

          imgpanel = new ImagePanel();
          capture = new JButton("Capture");

          String str1 = "vfw:Logitech USB Video Camera:0";
          String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
          //di = CaptureDeviceManager.getDevice(str2);
          // ml = di.getLocator();
          ml = new MediaLocator("vfw://0");

          try {
            player = Manager.createRealizedPlayer(ml);
            Component comp;

            if ((comp = player.getVisualComponent()) != null) {
              add(comp, BorderLayout.NORTH);
            add(capture, BorderLayout.CENTER);
            add(imgpanel, BorderLayout.SOUTH);
          } catch (Exception e) {

Download Webcam Capture (Executable Jar file) or see a live demonstration on my Cubecam.