title: How to install the library Deeplearning4j with IntelliJ and Maven?
body: <p>I'm trying to install the Deeplearning4j library ( <a href="https://deeplearning4j.org/index.html" rel="nofollow noreferrer">https://deeplearning4j.org/index.html</a>) but I don't understand how to use install the lib correctly with IntelliJ and Maven so that I can build a .jar file from it. </p>
  
  <p>As long as I'm running the program from IntelliJ everything seems to work.</p>
  
  <p>This is my pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;DeepLearning&lt;/groupId&gt;
  &lt;artifactId&gt;deeplearning&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  &lt;dependencies&gt;
  
  
      &lt;!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-core --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.deeplearning4j&lt;/groupId&gt;
          &lt;artifactId&gt;deeplearning4j-core&lt;/artifactId&gt;
          &lt;version&gt;0.9.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.nd4j/nd4j-native --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.nd4j&lt;/groupId&gt;
          &lt;artifactId&gt;nd4j-native&lt;/artifactId&gt;
          &lt;version&gt;0.9.1&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- https://mvnrepository.com/artifact/org.nd4j/nd4j-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.nd4j&lt;/groupId&gt;
          &lt;artifactId&gt;nd4j-api&lt;/artifactId&gt;
          &lt;version&gt;0.9.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.nd4j/nd4j-native-platform --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.nd4j&lt;/groupId&gt;
          &lt;artifactId&gt;nd4j-native-platform&lt;/artifactId&gt;
          &lt;version&gt;0.9.1&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- https://mvnrepository.com/artifact/org.datavec/datavec-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.datavec&lt;/groupId&gt;
          &lt;artifactId&gt;datavec-api&lt;/artifactId&gt;
          &lt;version&gt;0.9.1&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-jar-plugin&lt;/artifactId&gt;
  
              &lt;configuration&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;mainClass&gt;MLPClassifierLinear&lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
              &lt;/configuration&gt;
  
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am not sure if everything is set up correctly because it's the first time I use maven. </p>
  
  <p>When I run the maven install command and start the .jar file I get an error that says that a JNI error has occurred and a NoClassDefFoundError.</p>
  
  <p>This is the exact error message:</p>
  
  <p>Error: A JNI error has occurred, please check your installation and 
          try again
          Exception in thread "main" java.lang.NoClassDefFoundError: 
          org/deeplearning4j/nn/conf/layers/Layer     at java.lang.Class.getDeclaredMethods0(Native Method)   at
      java.lang.Class.privateGetDeclaredMethods(Class.java:2701)  at
      java.lang.Class.privateGetMethodRecursive(Class.java:3048)  at
      java.lang.Class.getMethod0(Class.java:3018)     at
      java.lang.Class.getMethod(Class.java:1784)  at
      sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
          at
      sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
          Caused by: java.lang.ClassNotFoundException: 
          org.deeplearning4j.nn.conf.layers.Layer     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)   at
      java.lang.ClassLoader.loadClass(ClassLoader.java:424)   at
      sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)   at
      java.lang.ClassLoader.loadClass(ClassLoader.java:357)   ... 7 more</p>
  
  <p>Can somebody explain me how to use maven correctly so I can build .jar files without getting errors?</p>
  
  <p>Thank you :) </p>