Hi all, I have a problem with JFM.
i am trying to capture an image from my web cam.
i can show the image through my JMF Studio but when i try to use a code it looks like it doesnt know that the device even exists.
here is the code:

public static void main(String[] args) throws Exception
{
// Create capture device
CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
Player player = Manager.createRealizedPlayer(deviceInfo.getLocator ());
player.start();

// Wait a few seconds for camera to initialise (otherwise img==null)
Thread.sleep(2500);
//
// // Grab a frame from the capture device
FrameGrabbingControl frameGrabber = (FrameGrabbingControl)player.getControl("javax.med ia.control.FrameGrabbingControl");
Buffer buf = frameGrabber.grabFrame();

// Convert frame to an buffered image so it can be processed and saved
Image img = (new BufferToImage((VideoFormat)buf.getFormat()).create Image(buf));
BufferedImage buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics2D g = buffImg.createGraphics();
g.drawImage(img, null, null);

// Overlay curent time on image
g.setColor(Color.RED);
g.setFont(new Font("Verdana", Font.BOLD, 16));
g.drawString((new Date()).toString(), 10, 25);

// Save image to disk as PNG
ImageIO.write(buffImg, "png", new File("c:\\webcam.png"));

// Stop usin webcam
player.close();
player.deallocate();
System.exit(0);

CaptureDeviceInfo device = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
if(device==null)
{
System.out.println("no device");
}
else
System.out.println("device exists");


when i am trying it it says "Exception in thread "main" java.lang.NullPointerException
at capture.main(capture.java:25)"
its like it doesnt know the device exists even though i can use it through the JMF studio.
and if i am trying to rum just from the variable "device" to the end(and putting all the rest in "//" it says "no device".
what should i do.
I even tried to reinstall it in another directory and run as admin but it did not work.