title: Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot find TensorFlow native library for OS: linux, architecture: x86_64
body: <p>I am trying setup TensorFlow Java application in Eclipse Oxygen (OS: Ubuntu Linux 16.x). I installed Tensorflow and followed the process <a href="https://www.tensorflow.org/install/install_java" rel="nofollow noreferrer">mentioned in official documentation</a> for Java (Maven Project) installation. I downloaded libtensorflow-1.3.0.jar, jni files and included in the build path. When I execute the program I get this following error </p>
  
  <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot find TensorFlow native library for OS: linux, architecture: x86_64. See https://github.com/tensorflow/tensorflow/tree/master/tensorflow/java/README.md for possible solutions (such as building the library from source). Additional information on attempts to find the native library can be obtained by adding org.tensorflow.NativeLibrary.DEBUG=1 to the system properties of the JVM.
  at org.tensorflow.NativeLibrary.load(NativeLibrary.java:66)
  at org.tensorflow.TensorFlow.init(TensorFlow.java:36)
  at org.tensorflow.TensorFlow.&lt;clinit&gt;(TensorFlow.java:40)
  at com.tensorflow.malwaredetection.App.main(App.java:13)
  </code></pre>
  
  <p>App.java</p>
  
  <pre><code>package com.tensorflow.malwaredetection;
  
  import org.tensorflow.TensorFlow;
  
  /**
   * Hello world!
   *
   */
  public class App 
  {
      public static void main( String[] args )
      {
          System.out.println( "Hello World!"+ TensorFlow.version() );
      }
  }
  </code></pre>
  
  <p>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;TensorFlow&lt;/groupId&gt;
    &lt;artifactId&gt;MalwareDetection&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;MalwareDetection&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
       &lt;exec.mainClass&gt;App&lt;/exec.mainClass&gt;
         &lt;!-- The sample code requires at least JDK 1.7. --&gt;
         &lt;!-- The maven compiler plugin defaults to a lower version --&gt;
         &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
         &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
    &lt;/properties&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.tensorflow&lt;/groupId&gt;
        &lt;artifactId&gt;libtensorflow&lt;/artifactId&gt;
        &lt;version&gt;1.3.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I got tired of this error and tried to do this in an old-fashioned way. Created App.java in a separate folder and included jar, jni files in the same directory. When I execute this from command line, I get different error  </p>
  
  <pre><code>dev@ubuntu:~/Downloads$ javac -cp libtensorflow-1.3.0.jar Test1.java
  dev@ubuntu:~/Downloads$ java -cp libtensorflow-1.3.0.jar:. -Djava.library.path=./jni Test1
  Error: Could not find or load main class Test1
  dev@ubuntu:~/Downloads$ 
  </code></pre>