首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > 加载DLL到Web容器共享类装载器

加载DLL到Web容器共享类装载器

  • 资源大小:4.47 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: web dll 共享 加载 容器 装载

资 源 简 介

What is this? This code is intended to solve a small, but annoying problem that occurs when loading native libraries (specifically DLLs) within a web container (Tomcat in this case). Loading a DLL into a Web Container Intuitively, the following code would be written to load a DLL within a web container. System.loadLibrary("name-of-dll"); It is important to only call this method once, as calling it multiple times will result in the following error: java.lang.UnsatisfiedLinkError: Native Library "name-of-dll" already loaded ... Loading a DLL once in a Web Container To correct for this issue, you can load the DLL in a static initializer block, which guarantees that it is only loaded once for the lifetime of the classloader assigned to that web container. static { System.loadLibrary("name-of-dll");} However, if the webapp is redeployed within a runni
VIP VIP
0.186161s