# Add third-party jar to URCap: Missing requirements

**URL:** <https://forum.universal-robots.com/t/add-third-party-jar-to-urcap-missing-requirements/3101>\
**Category:** Java\
**Created:** [November 13, 2018, 8:15am UTC](https://forum.universal-robots.com/t/add-third-party-jar-to-urcap-missing-requirements/3101 "2018-11-13T08:15:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![artiminds](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@artiminds](https://forum.universal-robots.com/u/artiminds)\
**Post date:** [November 13, 2018, 8:15am UTC](https://forum.universal-robots.com/t/add-third-party-jar-to-urcap-missing-requirements/3101/1 "2018-11-13T08:15:33Z")

</div>

Hello,

I’m trying to to add a third-party jar to my URCap (Java Media Framework/JMF), but can’t figure out how to do that.

I add a new dependency to my pom.xml file:

`<dependency>`  
`<groupId>javax.media</groupId>`  
`<artifactId>jmf</artifactId>`  
`<version>2.1.1e</version>`  
`</dependency>`

Then I’ve used the “Embed-Dependency” tag, as suggested in these two topics:

> [@Embedding dependencies in a URCap](https://forum.universal-robots.com/t/embedding-dependencies-in-a-urcap/498):
>
> If you need to embed a necessary bundle for your URCap plugin, please refer to the [Apache Felix Maven Bundle Plugin](http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html). The bundle must be “embedded” inside the .urcap file, which essentially is a .jar file. Please check your pom.xml file for the \<Embed-Dependency\> tag, and embed the bundle through here. You can check is the dependency is a success, by checking the .jar file after build for the referenced dependency. Besides from embedding the necessary classes, OSGi will also expect MANIFEST.m…

> [@Error adding dependency org.eclipse.swt in URCap](https://forum.universal-robots.com/t/error-adding-dependency-org-eclipse-swt-in-urcap/2232):
>
> Hi everyone, I am trying to add the Software Toolkit Package as a dependency to my URCap in my pom file. I am adding the following: \<repositories\> \<repository\> \<id\>maven-eclipse-repo\</id\> \<url\>http://maven-eclipse.github.io/maven\</url\> \</repository\> \</repositories\> \<dependencies\> ... \<dependency\> \<groupId\>org.eclipse.swt\</groupId\> \<artifactId\>org.eclipse.swt.gtk.linux.x86\_64\</artifactId\> \<version\>4.6.1\</version\> \</dependency\> ... \</depende…

`<Embed-Dependency>!javax.media*</Embed-Dependency>`

After doing so, “mvn install” will work and shows the state “BUILD SUCCESS”. When I open the generated .urcap file I can  
also see the jar inside the .urcap file.  
But when I install the URCap, the URcap is marked with a yellow warning sign and shows the following error:

`org.osgi.framework.BundleException: Unable to resolve com.test.urcap [334](R 334.0): missing requirement [com.test.urcap [334](R 334.0)] osgi.wiring.package; (osgi.wiring.package=com.ms.awt) Unresolved requirements: [[com.test.urcap [334](R 334.0)] osgi.wiring.package; (osgi.wiring.package=com.ms.awt)]`

I’ve tried several things to fix this, e.g. the suggestions from these two forum topics:

> [@Error adding dependency org.eclipse.swt in URCap](https://forum.universal-robots.com/t/error-adding-dependency-org-eclipse-swt-in-urcap/2232):
>
> Hi everyone, I am trying to add the Software Toolkit Package as a dependency to my URCap in my pom file. I am adding the following: \<repositories\> \<repository\> \<id\>maven-eclipse-repo\</id\> \<url\>http://maven-eclipse.github.io/maven\</url\> \</repository\> \</repositories\> \<dependencies\> ... \<dependency\> \<groupId\>org.eclipse.swt\</groupId\> \<artifactId\>org.eclipse.swt.gtk.linux.x86\_64\</artifactId\> \<version\>4.6.1\</version\> \</dependency\> ... \</depende…

> [@How to use the third-part .jar files?](https://forum.universal-robots.com/t/how-to-use-the-third-part-jar-files/367):
>
> Hello: In my URCAPS,I want to use the third-part .jar files. e.g. seroUtils.jar and modbus4j.jar. When I compile the project , it was compiled successed.But when I add it in POLYSCOPE,before the URCAP,there’s a yellow “!”. How can I solve this problem. Thank you!sob

I’ve also used Eclipse to generate a MANIFEST.MF file/OSGi bundle for the third-party jar. But the result is always  
the same, “mvn install” runs just fine, but execution of the installed URCap does not work.

What am I missing? Is there a working example with third-party jars?

Thank you very much.

---

<div class="post-metadata">

**Author:** ![artiminds](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@artiminds](https://forum.universal-robots.com/u/artiminds)\
**Post date:** [November 19, 2018, 7:53am UTC](https://forum.universal-robots.com/t/add-third-party-jar-to-urcap-missing-requirements/3101/2 "2018-11-19T07:53:14Z")

</div>

Anyone an idea or has an example?  
Continued on trying different things out, but always the same error message…

---

<div class="post-metadata">

**Author:** ![anon65872039](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@anon65872039](https://forum.universal-robots.com/u/anon65872039)\
**Post date:** [November 19, 2018, 10:01am UTC](https://forum.universal-robots.com/t/add-third-party-jar-to-urcap-missing-requirements/3101/3 "2018-11-19T10:01:28Z")

</div>

I had a similar error at some point with another package, I am pretty sure that ‘osgi.wiring.package=com.ms.awt’ means you’re missing the dependency ‘com.ms.awt’, although i don’t know which package that dependency belongs to.  
I resolved my error by finding my missing dependencies on [https://mvnrepository.com/](https://mvnrepository.com/) and adding these as dependencies in my pom file, although it did require a large amount of dependencies (as some of the dependencies i added, had their own dependencies). There might be a better way of doing this, but I have not found it 🙂

---

<div class="post-metadata">

**Author:** ![artiminds](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@artiminds](https://forum.universal-robots.com/u/artiminds)\
**Post date:** [November 20, 2018, 8:10am UTC](https://forum.universal-robots.com/t/add-third-party-jar-to-urcap-missing-requirements/3101/4 "2018-11-20T08:10:39Z")

</div>

Thank you very much for the replay and help.  
I’ll try this out and make some research about “com.ms.awt”.

The answer of thomas gave me the correct hints:  
The line " `osgi.wiring.package=com.ms.awt`" inside the error message is important as it shows which elements have to be added to the `Import-Packages` tag. When I add com.ms.awt it shows me the same error message again, but with a different package. I add the package, try again and so on until no more error messages appear.  
Then I had to make some changes to the syntax (found out by google) and it works now. 🙂

So my complete pom looks like this:  
`<Import-Package> com.ur.urcap.api*;version="[1.3.0,2.0.0)", javax.media*;resolution:=optional, com.ms.awt*;resolution:=optional, com.ms.net.wininet*;resolution:=optional, com.ms.security*;resolution:=optional, com.sun.net.ssl.internal.ssl*;resolution:=optional, netscape.security*;resolution:=optional, sun.audio*;resolution:=optional, sun.awt.image*;resolution:=optional, * </Import-Package>`

`<Embed-Dependency> !javax.media, !org.osgi.core, !com.ur.urcap.api, *; scope=compile|runtime </Embed-Dependency>`

I had to add only one dependency for jmf:  
`<dependency> <groupId>javax.media</groupId> <artifactId>jmf</artifactId> <version>2.1.1e</version> </dependency>`
