war package deployed in tomcat, start the tomcat server using windows service service, the module contains a call dll, the solution to the problem newspaper dll not found

Problem Description:

A java web development programs need to call a dll, in idea development environment, debugging run no problem, you can run properly in tomcat / bin, run the batch startup.bat, start tomcat server, it can also run normally. Except in the windows service mode, use the service to start the way, web running tomcat / webapps / under, no need to call logic dll's, works fine, but you need to call the place include third-party dll's, they reported the error, suggesting that Can not find dll directory jre / bin, obviously dll in this directory. This puzzled for several days.

Advance Description: Configuring the JAVA_HOME \ JRE_HOME environment variable.

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
JRE_HOME=C:\Program Files\Java\jdk1.8.0_131\jre

The ultimate solution:

A saying: the dependent dll file on Tomcat installation directory bin folder, and startup.bat in before they can be loaded at the same level of success dll directory. This is the way my last resort. It is the only method that can be used. (

For my environment so, is this the windows, under linux, not test, the Internet, he said, under Linux, the files in the / user / local / bin in, linux is so dependent on the jar file)

 

In this Acknowledgment of these articles about the author

Reference a lot of articles, will not work:

1. method (derived from actual project experience) to load the dll file in the tomcat web project based in  this article to solve my problem, the dll copy directly to the tomcat / bin directory, which is running tomcat home directory under.

2. the Java work notes: the use jni and jna call DLL files when deploy Tomcat , see Article.

3. the Java path or so to load dll library files java.library.path  (extended field of view, this did not play any useful)

 

Guess you like

Origin www.cnblogs.com/wangqiideal/p/11246309.html