简体   繁体   中英

Java native library path in Tomcat web project

I have a web project with some native libraries. Most of them are loaded by JNA library.

I put them in this folder

WEB-INF\classes\*.dll

of a ROOT package.

When the application starts they are loaded by Tomcat in

${catalina.home}\webapps\ROOT\WEB-INF\classes\mylibrary.dll

All libraries are founded by JNA and work, however there is just one library managed by third parties (Zebra Multilink platform SDK) that I cannot load from that folder. Maybe because it doesn't work with JNA but with JNI. If I move that libraries to

 ${catalina.home}\bin

that is the folder defined by java.library.path param in tomcat start command it works!

Can I distribute libraries in ROOT.war package and set tomcat to look into all my applications to find native libraries?

好了,您可以修改java.library.path并使其指向展开的webapp目录(您的${catalina.home}\\webapps\\ROOT\\WEB-INF\\classes\\ ,但需要自己先解析${catalina.home} ) 。

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