0

I am trying to use my cam in java app but i get some errors here is the my code. its simple someone tells me whats wrong with my code:

import java.util.Vector;
import javax.media.CaptureDeviceInfo;
import javax.media.CaptureDeviceManager;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.swing.JFrame;
public class Main extends JFrame {

    public Main(){

        super("Jcam");
        try {


        Vector v = CaptureDeviceManager.getDeviceList(null);
        CaptureDeviceInfo cam = null;
        for(int i=0;i<v.size();i++)
        {
            CaptureDeviceInfo dev = (CaptureDeviceInfo) v.elementAt(i);
            if(dev.getName().startsWith("vfw"))
            {
                cam = dev;
                break;
            }
            System.out.println(dev.getName());

        }
        if (cam == null){ System.exit(0); }
        MediaLocator ml = cam.getLocator();
        Player p = Manager.createRealizedPlayer(ml);
        add(p.getVisualComponent());
        p.start();
        } catch (Exception e) {

        }
        setSize(700, 700);
        setVisible(true);
    }
    /**
     * @param args
     */
    public static void main(String[] args) {
        new Main();
    }

and here is the log

Exception in thread "VFW Request Thread" java.lang.UnsatisfiedLinkError:     JMFSecurityManager: java.lang.UnsatisfiedLinkError: no jmvfw in java.library.path
    at com.sun.media.JMFSecurityManager.loadLibrary(JMFSecurityManager.java:206)
    at com.sun.media.protocol.vfw.VFWCapture.<clinit>(VFWCapture.java:19)
    at com.sun.media.protocol.vfw.VFWSourceStream.doConnect(VFWSourceStream.java:241)
    at com.sun.media.protocol.vfw.VFWSourceStream.run(VFWSourceStream.java:763)
    at java.lang.Thread.run(Unknown Source)
rekire
  • 47,260
  • 30
  • 167
  • 264
Fatih POLAT
  • 147
  • 1
  • 4
  • 16
  • you're probably missing a required native library on the library path. – asgs Sep 22 '12 at 08:05
  • I dont think so man. coz i have already added jmf.jar to my project – Fatih POLAT Sep 22 '12 at 08:28
  • Adding a library to your project is not the same as setting the library path for a Java instance. See [how-to-set-the-java-library-path-from-eclipse](http://stackoverflow.com/questions/957700/how-to-set-the-java-library-path-from-eclipse) for more details. – asgs Sep 22 '12 at 08:45
  • I did all of things that in the link u gave to me .. but it still dont work – Fatih POLAT Sep 22 '12 at 09:05

2 Answers2

0

Try downloading and including the platform independent distribution. I got the same error when I tried using jmf on windows - but when I switched from using the windows distribution to the platform independent one, it worked.

0

Solved.. its beceuse of 64 bit operating system..jmf doesnt work on 64 bit

Fatih POLAT
  • 147
  • 1
  • 4
  • 16