title: C++ program returns -1073741515 when is called from the Java Tomcat Servlet
body: <p>I have a C++ application which deals with the image processing (by OpenCV 2.4.10). When I call this program from the command line or from another local Java application with the following code snippet:</p>
  
  <pre><code>ProcessBuilder pb = new ProcessBuilder(_IMG_PROC_ENGINE_PATH, imgPath);
  pb.redirectError();
  Process p = pb.start();
  exitCode = p.waitFor();
  </code></pre>
  
  <p>everything is working and the CPP-application returns the correct outcome.</p>
  
  <p>But when I call the same CPP-program on the same PC with absolutely the same user account from <strong><em>Java Tomcat Servlet</em></strong>, I get an error return code <strong><em>-1073741515</em></strong> from the CPP. After some searching, I discovered that this code error occurs when there is a problem with an external library loading. And it's true if I remove the OpenCV libraries usage from my C++ program, everything is OK.</p>
  
  <p>My question is why when I execute the program locally from the command line or from another local Java application, everything is OK, but when I call the same C++ EXE from the <strong><em>Java Servlet</em></strong>, I get an error of library loading.</p>
  
  <p>How can I fix the issue?</p>
  
  <p>P.S. There is no antivirus or any other security software (e.g. Internet Security, EMET, etc.) on the PC, which can interrupt the process.</p>