在Netbeans RCP中利用JMF框架实现音频视频的传输,开始就遇到一个问题,网上搜索了一下,与下面这个类似,直接贴过来吧

——————————————————————————————————————————————————————————————

http://stackoverflow.com/questions/5887383/netbeans-platform-application-doesnt-detect-webcam-devices-with-jmf

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 :)

————————————————————————————————————————————————————————————————————————

上面最后提出了一个可行的解决方法,但不够好。下面是一些在Netbeans RCP中相关的设置native lib的方法:

http://deadlock.netbeans.org/hudson/job/faqsuck/lastSuccessfulBuild/artifact/other/faqsuck/build/faq.html#DevFaqNativeLibraries

DLLs or SOs can be placed in the folder release/modules/lib/ in a module project's sources (look in the Files tab). This will make them appear in the final NBM or application in a lib subdirectory beneath where the module's JAR resides. Then just use System.loadLibrary as usual.

API Reference: JNI in modules

Applies to: NetBeans 6.8 and above

————————————————————————————————————————————————————————————————————————

http://bits.netbeans.org/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#jni

JNI

It is possible to run modules making use of JNI native implementations inside NetBeans. You may place the native libraries (DLL or shared-object) beneath a
modules/lib

directory (i.e. a subdirectory
lib/

beneath the directory where the module JAR resides). If your native library file names for different architectures or operating systems clash, you may create subdirectories under
modules/lib

for each supported platform and nested subdirectories for each supported operating system. The directory names must match System.getProperty ("os.arch") and System.getProperty ("os.name").toLowerCase () respectively. The System.loadLibrary call originating from the module code will try to locate the library file in the following order of directories:

  • modules/lib/
  • modules/lib/<arch>/
  • modules/lib/<arch>/<os>/

so you may place e.g. 64bit linux version of a
foo

library in a file
modules/lib/amd64/linux/libfoo.so

. The module may distinguish additional library variants itself or even override the platform selection logic by naming the library file appropriately and calling System.loadLibrary with such a name. Use of JNI is of course not recommended and should be restricted to cases where it is unavoidable.

Example of usage: if on Linux a module located in
/home/app/cluster/modules/something.jar

calls
System.loadLibrary("stuff-linux-i386-gnome")

, the library should be in
/home/app/cluster/modules/lib/libstuff-linux-i386-gnome.so

. On 64bit Windows, if
C:\app\cluster\modules\something.jar

calls
System.loadLibrary("stuff")

, the library should be in
C:\app\cluster\modules\lib\amd64\stuff.dll

. (Remember that Java has platform-specific prefixes and suffixes it adds to plain library names before trying to find it on disk.)

If a native library refers to other native libraries, they are likely to be found using the normal search path for the platform. This may mean that if you have several libraries used in a module, you must either put all but the directly referenced one in the system's global library search path, or merge them all together.

Warning: since the JVM cannot load the same native library twice even in different classloaders, a module making use of this feature cannot be enabled more than once in a single VM session. JARs loaded from the classpath (application classloader) are never reloaded, so it may be possible to include the native-dependent classes in such a JAR and make use of it from a module JAR.

NetBeans currently includes a JNA wrapper module which can also be used for native access. As of this writing, however, this module exports only a friend API, so it is not available for use from arbitrary modules.

————————————————————————————————————————————————————————————————————

待我试下效果如何!

晕,全部管用,又找了一个,待我试试!

http://www.java.net/node/680780
jcd
Offline

Joined: 2005-06-06

Hi All,
I have a netbeans RCP application in which I replaced JEditPane by jdic WebBrowser but I always get the following message:

java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: null\jdic.dll
at java.lang.Runtime.load0(Runtime.java:767)
at java.lang.System.load(System.java:1005)
at org.jdesktop.jdic.init.JdicManager$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.jdesktop.jdic.init.JdicManager.loadLibrary(Unknown Source)
at org.jdesktop.jdic.browser.WebBrowser.(Unknown Source)

I have inserted a property in the project file:
run.args.extra=-J-Djava.library.path="C:\\jisis-01-10-2007\\jisis\\jdic.dll"

And I can see the interpreted VM option when running the application:
Input arguments:
-Dnetbeans.logger.console=true
-ea
-Djava.library.path=C:\jisis-01-10-2007\jisis\jdic.dll
-Djdk.home=C:\Program
Files\Java\jdk1.6.0_02

Any Help would be appreciated, Thanks in advance

jcd

***********

jcd
Offline

Joined: 2005-06-06

[u]Here is how I solved the issue:[/u]

I experienced problems when trying to use the latest release jdic-0.9.5-bin-cross-platform.zip and jdic-20061102-bin-crossplatform.zip. Thus I decided to try with the jdic-20061102-bin-win release

1) I created a library wrapper module for jdic providing jdic.jar as library

When executing my application, I noticed the following message:
[b]native lib path ….\build\cluster\modules\ext[/b]

From this message, I concluded that I should copy all native libraries into the
[b]…\build\cluster\modules\ext[/b]

2) I copied the whole bunch of jdic files into this folder: MozEmbed.exe, IeEmbed.exe, jdic.dll and tray.dll. jdic.jar was already there, copied by NetBeans.
My application worked perfectly

3) But I was loosing the jdic files each time I was cleaning and re-building the application.
Thus I copied the jdic files in the [b]…\jdic\release\modules\ext[/b] folder of the [b]jdic library wrapper module[/b]. And now the files are copied by NetBeans in the [b]….\build\cluster\modules\ext[/b]
and my application works fine.

Please note that it may be worth to try again the jdic-20061102-bin-crossplatform.zip and using the same process.

Hope you will find this useful, best wishes

JCD

————————————————————————————————————————————————————————————————————————

还是第一个方法管用!!!

转载于:https://www.cnblogs.com/cuizhf/archive/2011/11/02/2232807.html

关于Native Library在NetbeansRCP应用中的设置相关推荐

  1. Unable to load the Wrapper's native library because none of the following files及解决方法

    在有几个应用中,在启动的时候发现下列警告: The version of the script (3.5.29) doesn't match the version of this Wrapper ( ...

  2. Hama笔记:Unable to load native-hadoop library 和 Snappy native library not loaded 的解决

    Hama日志中总会看到这两句话: 13/05/03 11:58:57 WARN util.NativeCodeLoader: Unable to load native-hadoop library ...

  3. mac下hadoop 2.6.0编译native library

    本文中的所有路径请根据个人情况修改. 编译好的native library见个人资源:[http://download.csdn.net/detail/tterminator/9565597] 一.为 ...

  4. java jna java.lang.UnsatisfiedLinkError: Unable to load library Native library (win32-x86-64/C:\User

    背景 在新装的win系统下,java项目人脸识别项目要调用动态库,下面就说说问题 问题 Exception in thread "main" java.lang.Unsatisfi ...

  5. Unable to load library ‘c:\dcrf32.dll‘:Native library (win32-x86-64/c:\dcrf32.dll) not found

    报错信息Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Unable to load ...

  6. tomcat启动出现The APR based Apache Tomcat Native library错误

    今天在idea中直接启动springboot项目时,出现以下错误: The APR based Apache Tomcat Native library which allows optimal pe ...

  7. java运行Tomcat提示:The APR based Apache Tomcat Native library which allows optimal performance in produc

    在Tomcat上运行javaweb程序时,启动Tomcat时log信息中提示如下内容: 九月 18, 2017 4:34:51 下午 org.apache.catalina.core.AprLifec ...

  8. Subversion Native Library Not Available

    原地址:http://giraffe-blog.appspot.com/2010/04/16/svn-javaHL-eclipse.html  前一段时间更新了svn的eclipse插件,使用的时候就 ...

  9. The APR based Apache Tomcat Native library

    Tomcat启动的时候出现下面这样的提示: 2015-11-06 14:24:12 org.apache.catalina.core.AprLifecycleListener init 信息: The ...

最新文章

  1. Java集合类解析 ***
  2. 什么是SAP重复性生产
  3. libevent -简单的异步IO介绍
  4. 收集Redis 经典面试题
  5. Codeforces Round #703 (Div. 2) 题解
  6. mysql数据库 day04
  7. Yii2学习笔记(一):Yii的安装和使用(base版)
  8. keyerror什么意思python_为什么会出现keyerror?
  9. 赴日软件工程师,据说很火
  10. sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, “You have an error in your SQ
  11. 计算机主机麦克风三个孔,台式机耳机和麦克风怎么通用一个插孔
  12. 大数据公司挖掘数据价值的49个典型案例
  13. python爬虫必备防检测工具
  14. SAP模块介绍及概念介绍
  15. 帝国理工大学计算机科学排名,帝国理工学院世界排名及专业排名汇总(QS世界大学排名版)...
  16. 小鸟且偷生, 飞入天空便自由!
  17. 程序员开始吃青春饭了?35岁面试直接被送走,不惜降薪跳槽?
  18. python ftplib读取的文件名有空格,在Python中从FTP文件夹(文件名有空格)获取最新文件...
  19. MySQL 主键性能解析
  20. 淘宝/天猫,各大平台API操作(api接口)

热门文章

  1. 「冰河技术」部分精华文章分类汇总,P8架构师都在看的技术文章!!
  2. java web 点着点着就死掉了_Websphere(was)故障-挂死,重启,产生core.*.dmp,javacore文件-分析和解决...
  3. android 设置背景ah,Ahjesus,
  4. java判断object对象为不为空
  5. EFM32芯片jlink无法连接,无法调试,解锁流程
  6. 【雷达通信】滤波及数据融合【滤波包括了常增益滤波、卡尔曼(Kalman)滤波和扩展卡尔曼滤波(EKF) 数据融合采用BC和CC两种,基于KF和EKF实现】(Matlab代码实现)
  7. android sqlite存对象,【Android基础】Android SQLite存储自定义对象
  8. 用户不在 sudoers 文件中此事将被报告
  9. torchtorchvision对应版本
  10. KA算法:一种低复杂度的预编码/接收机设计思路