title: The java system library do not load opencv library
body: <p>I'm using the opencv library in a java project. I have a simple java project that compiles as a 'jar', and manually adding  the opencv library, then, I know that I have to put this code after nothing:</p>
  
  <blockquote>
    <p>System.loadLibrary(Core.NATIVE_LIBRARY_NAME);</p>
  </blockquote>
  
  <p>This works well, but now, I need the same application running in a server, so I made a maven simple project that compiles in a 'war' and added opencv in a dependency, but in the line above I get this error.</p>
  
  <pre><code>Caused by: java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path
  </code></pre>
  
  <p>And I guess it is true because is a maven dependency.
  How I fix this?</p>
  
  <p>Here is my pom.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;org.springframework.samples&lt;/groupId&gt;
  &lt;artifactId&gt;RetinoblastomappSpring&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;description&gt;Tesis de diagnostico temprano retinoblastoma&lt;/description&gt;
  
  &lt;properties&gt;
  
      &lt;!-- Generic properties --&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
  
      &lt;!-- Spring --&gt;
      &lt;spring-framework.version&gt;3.2.3.RELEASE&lt;/spring-framework.version&gt;
  
      &lt;!-- Hibernate / JPA --&gt;
      &lt;hibernate.version&gt;4.2.1.Final&lt;/hibernate.version&gt;
  
      &lt;!-- Logging --&gt;
      &lt;logback.version&gt;1.0.13&lt;/logback.version&gt;
      &lt;slf4j.version&gt;1.7.5&lt;/slf4j.version&gt;
  
      &lt;!-- Test --&gt;
      &lt;junit.version&gt;4.11&lt;/junit.version&gt;
  
      &lt;!-- OpenCV --&gt;
      &lt;opencv.version&gt;2.4.9-4&lt;/opencv.version&gt;
  
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;!-- Spring and Transactions --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;${spring-framework.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
          &lt;version&gt;${spring-framework.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Logging with SLF4J &amp; LogBack --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;${slf4j.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
          &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
          &lt;version&gt;${logback.version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Hibernate --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- Test Artifacts --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
          &lt;version&gt;${spring-framework.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;${junit.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- OpenCV --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;nu.pattern&lt;/groupId&gt;
          &lt;artifactId&gt;opencv&lt;/artifactId&gt;
          &lt;version&gt;${opencv.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.4.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I added the library by hand, and is the same, The war is compiling OK, but when I execute it, that line fails and I get the same error.</p>
  
  <p>I read that I have to add opencv to my system variables, but that didn't work</p>