# Packaging jar library and jni dll

**URL:** <https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103>\
**Category:** Module Development\
**Tags:** ignition81\
**Created:** [November 20, 2023, 1:46am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103 "2023-11-20T01:46:54Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Robertson](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@James\_Robertson](https://forum.inductiveautomation.com/u/James_Robertson)\
**Post date:** [November 20, 2023, 1:46am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/1 "2023-11-20T01:46:54Z")

</div>

I am building an opc-ua module that is using a third party library comprising a jar file and jni dll.

Can the jar file and dll be packaged in the modl file. I am new to maven, I haven't even been able to package the library using methods on this stack overflow post, [Generate a runnable jar and include libraries in it with Maven - Stack Overflow](https://stackoverflow.com/questions/26526694/generate-a-runnable-jar-and-include-libraries-in-it-with-maven)

I was able to work around the jar file by placing it manually in the ignition directory /lib/core/

The jni dll is required to be placed in C:\Windows\System32. It works when I use the library in a stand alone java application, however ignition is throwing a 'java.lang.UnsatisfiedLinkError'

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 20, 2023, 3:27am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/2 "2023-11-20T03:27:11Z")

</div>

If the library you're using is calling `System.loadLibrary` and not giving you a chance, you'll have to put the DLL somewhere on the `java.library.path`. I'm pretty sure by default that includes the `lib/core/gateway` folder, but you can print the value out at runtime and see for sure.

Ideally the library lets you load it yourself via `System.load`, and then you can extract the DLL to a temp directory of your choice and load it explicitly.

---

<div class="post-metadata">

**Author:** ![James\_Robertson](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@James\_Robertson](https://forum.inductiveautomation.com/u/James_Robertson)\
**Post date:** [November 20, 2023, 4:17am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/3 "2023-11-20T04:17:10Z")

</div>

Thanks, I've put the dll in system32 and lib/core/gateway. After restarting the ignition service, it recognized the dll.

---

<div class="post-metadata">

**Author:** ![James\_Robertson](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@James\_Robertson](https://forum.inductiveautomation.com/u/James_Robertson)\
**Post date:** [November 21, 2023, 12:21am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/4 "2023-11-21T00:21:48Z")

</div>

Can anyone help with the maven packaging, or is that best suited for a maven forum?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 21, 2023, 12:59am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/5 "2023-11-21T00:59:42Z")

</div>

What is it exactly you need help with?

We do have a somewhat deprecated [Maven plugin](https://github.com/inductiveautomation/ignition-maven-plugin) to help assemble a `modl` file, but I'm not sure if that's where you're at yet?

---

<div class="post-metadata">

**Author:** ![James\_Robertson](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@James\_Robertson](https://forum.inductiveautomation.com/u/James_Robertson)\
**Post date:** [November 21, 2023, 1:06am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/6 "2023-11-21T01:06:15Z")

</div>

I used the example opc-ua from github that includes a maven build. I can't figure out how to include the third party jar file in the modl. Or the dll, but i'm not sure if that is even possible.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 21, 2023, 1:17am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/7 "2023-11-21T01:17:37Z")

</div>

Just a standard Maven dependency entry, except it wouldn't be "provided" scope like this one:

> <https://github.com/inductiveautomation/ignition-sdk-examples/blob/da3c7e073686f62dbbd6d228ed55468b6d7f1575/opc-ua-device/opc-ua-device-gateway/pom.xml#L37C1-L42C22>

> [@James\_Robertson](#):
>
> Or the dll, but i'm not sure if that is even possible.

Ideally your JAR would have the DLL packaged as a resource inside it. Not sure there's anything to help you get it into the `modl` file on the plugin side.

---

<div class="post-metadata">

**Author:** ![James\_Robertson](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@James\_Robertson](https://forum.inductiveautomation.com/u/James_Robertson)\
**Post date:** [November 21, 2023, 1:23am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/8 "2023-11-21T01:23:31Z")

</div>

Thanks, unfortunately I've already tried that.  
I know it finds the library because it couldn't build before, but it doesn't include it in the final jar.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 21, 2023, 1:26am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/9 "2023-11-21T01:26:20Z")

</div>

The Ignition maven plugin is only responsible for assembling your `modl` file, not assembling your JAR or including the native library inside that JAR. This is a dependency you are presumably getting from somewhere else, and simply including/using it in your module.

---

<div class="post-metadata">

**Author:** ![James\_Robertson](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@James\_Robertson](https://forum.inductiveautomation.com/u/James_Robertson)\
**Post date:** [November 21, 2023, 2:21am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/10 "2023-11-21T02:21:52Z")

</div>

I'm trying to package the 3rd party jar inside the gateway jar.  
It sounds like maven can do this, as per stack-overflow topic I referenced above, but the guides haven't worked for me.

If this is more appropriate to ask in a maven forum I will take it there.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 21, 2023, 2:28am UTC](https://forum.inductiveautomation.com/t/packaging-jar-library-and-jni-dll/82103/11 "2023-11-21T02:28:56Z")

</div>

Yeah it might be more appropriate. We don't even use Maven any more, and did not attempt to package everything to together in a single JAR using the method outlined in that SO post.
