Netbeans 平台应用程序未使用 JMF 检测网络摄像头设备
我一直在尝试使用 Netbeans RCP 开发一个应用程序来从网络摄像头抓取图像。 简单明了,它可以在常规 Java 项目中运行。
因此,首先必须安装 JMF(我使用的是 Windows 7 64 位,(JMF 需要 32 位 JDK)。
在常规 Java 项目中,我有以下代码:
Vector webcams = CaptureDeviceManager.getDeviceList(null);
int length = webcams.size();
System.out.println("length: " +length);
输出为“length: 1”( 1 个网络摄像头已连接)
当我在 Netbeans 平台项目中执行此操作时,此输出为“长度:0”,
所以基本上我有我的 Netbeans 项目套件 。 2 个模块:
- JMF 库(带有 jmf.jar 的包装模块)
- 网络摄像头模块(包含 1 个带有上述代码的 java 文件)
我将 JMF 库模块作为依赖项添加到网络摄像头模块中,但这并没有解决问题。 我还可以确认类路径已设置:
Boot & Ext. Classpath = C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\jsse.jar;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\modules\jdk.boot.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\classes;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\dnsns.jar;**C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\jmf.ja**r;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sound.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sunjce_provider.jar;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sunpkcs11.jar
我真的被困在这里了。 Netbeans RCP 有什么特别之处,以至于添加 jmf.jar 作为包装器模块似乎会破坏此代码?
如果有人有一些提示来帮助获取更多调试信息来跟踪问题,我将非常感激。
编辑:
经过大量的试验和错误,我找到了以下解决方案:
Copy c:\Progra.... x86\JMF...\lib\* to c:\Program .. x86\jdk\lib\*
Including the jmf.properties file
但是我很高兴这有效,一旦应用程序转移到另一台客户端 PC 进行使用,那里就不会有这些库。
所以我真的不知道如何用Netbeans RCP解决这个问题。这有多难?我将 jar 添加到包装器中,还将 .properties 文件放置在 /release/modules/ext 文件夹中。
请在这里帮助我:)
I've been trying to develop an application with Netbeans RCP to grab images from a webcam.
Plain and simple, it works in a regular Java project.
So first of all the JMF must be installed (I'm on Windows 7 64bit, (32bit JDK which is needed for JMF).
In a regular Java project I have the following code:
Vector webcams = CaptureDeviceManager.getDeviceList(null);
int length = webcams.size();
System.out.println("length: " +length);
The output for this is "length: 1" (1 webcam connected)
When I do this in my Netbeans platform project this output is "length: 0".
So basicly I have my Netbeans project suite
2 modules:
- JMF libraries (wrapper module with jmf.jar)
- Webcam module (contains 1 java file with the above code)
I added the JMF libraries module to the Webcam module as a Dependency but this didn't do the trick.
I can also confirm that the classpath is set:
Boot & Ext. Classpath = C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\rt.jar;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\jsse.jar;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\modules\jdk.boot.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\classes;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\dnsns.jar;**C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\jmf.ja**r;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sound.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sunjce_provider.jar;
C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.6.0_25\jre\lib\ext\sunpkcs11.jar
I am really stuck here. What is so special about Netbeans RCP that adding jmf.jar as a wrapper module seems to break this code?
If someone has some tips to help get more debug information to trace the problem I'm very grateful.
EDIT:
After a lot of trial and error I found the following solution:
Copy c:\Progra.... x86\JMF...\lib\* to c:\Program .. x86\jdk\lib\*
Including the jmf.properties file
However I am happy that this works, once the app transfer to another client PC for usage it will not have those libs there.
So I really don't know how to solve this problem with Netbeans RCP. How hard can it be? I added the jars to the wrapper, I placed the .properties file in the /release/modules/ext folder as well.
Please help me out here :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我在Netbeans中使用JMF时。我必须执行以下操作:
tools -->库
库
添加库
这就是全部
When I used JMF in Netbeans. I had to do the following:
tools --> libraries
libraries
of your projectadd library
Thats all
您必须添加到 build.xml 中:(jmf.propeties 必须位于 COMPILED dist 文件夹中,靠近您的 your_jar.jar!!!)
转到 Project Explorer 中的 Files 选项卡,然后添加到 build.xml 中
(我的 JMF 是在 c:\JMF...)
You have to add into build.xml: (jmf.propeties have to be in COMPILED dist folder, near to Your your_jar.jar!!!)
go to Files tab in Project Explorer, and add into build.xml
(JMF by me is in c:\JMF...)