Could I pack native DLLs into WAR?

后端 未结 6 548
迷失自我
迷失自我 2021-01-13 19:07

I\'m developing a web service which is using native code via JNI. Could I pack those dll\'s into my war?
I\'ve tired to manage them independently...

PS I\'m usin

6条回答
  •  隐瞒了意图╮
    2021-01-13 19:09

    If your dependency does not have provided, it will get included in the war file no matter the type (jar, zip, etc, unless it's another war).

    While this is true, there is however the problem that you need to have the native library (.so, .dll) on your java.library.path. EJP's concerns are valid. However, if you play around with the assembly plugin and have the dll placed under the /META-INF directory of your war file, you can easily knock up some code that extracts that dll from the classpath /META-INF/my.dll and places it in a directory on the java.library.path.

    This is far from being anything remotely close to good practice, but I believe you can hack it like this.

提交回复
热议问题