Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundling native dll with jar [duplicate]

Possible Duplicate:
How to bundle a native library and a JNI library inside a JAR?

I need to include native lib (jnotify but I think that it does't matter) to my jar. I want to do it with NetBeans.

I added Bundle-NativeCode: /lib/jnotify.dll; osname=win32 to my manifest.mf file and added jnotify.dll to projektHome\src\lib\ folder. But unfortunately NetBeans is overidning manifest.mf file.

How can I fixed? Can I do this using only NetBeans? Is it line 'Bundle-NativeCode: /lib/jnotify.dll; osname=win32 correct? I also heard I should put dlls hash in manifest.mf and sign my jar. Is that true?

like image 686
Maciek Sawicki Avatar asked Dec 04 '09 10:12

Maciek Sawicki


1 Answers

I don't think the Java executable supports Bundle-NativeCode. I'm pretty sure that is an OSGi attribute. The list of supported attributes is defined in the JAR File Specification.

Outside frameworks that provide it, there is no built-in support for bundling native libraries inside JAR files. If I recall correctly, it is possible to extract the file to a temporary location and load it manually.

like image 175
McDowell Avatar answered Sep 28 '22 23:09

McDowell