简体   繁体   中英

Accessing external library (jmf) within jar file

We used an external library, specifically jmf.jar (Java Media Framework), for our java application which relies on images captured from the webcam. However, when we tried to package the application into a jar file, the application runs but once we try to access/open the webcam nothing happens.

We are using Eclipse and we used its export feature to create the jar file.

Does anybody know how to solve this?

Did you think to include jmf in the manifest of your jar ? See this link for more explanations here

如果使用的是JMF,则需要在与可执行jar相同的目录中包含jmf.jar和jmf.properties

You don't just need to export your project into a jar file; you need to create an "executable" jar file. This means that the manifest of the jar file is edited appropriately so that the classpath includes all required dependencies and the main class is set correctly.

In recent versions of Eclipse you can use the Runnable JAR File Export Wizard . Have also a look at the Fat Jar Eclipse Plug-in .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM