0

Now that there is experimental support for Java on TensorFlow, I wanted to get started on Windows, following the steps in the readme

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/java/README.md

I got the expected error:

java.lang.UnsatisfiedLinkError

The Python version is running fine, but that is not Java....

The readme points to native libraries for Mac and Linux, can someone confirm that I just have to wait a bit ?

mpjjonker
  • 917
  • 1
  • 6
  • 28
  • The native libraries for Windows haven't been built/released, but have you tried the "Building from source" instructions in the README for creating the native library? – ash Feb 20 '17 at 17:46
  • @ash No I started in "lazy" mode... to be continued – mpjjonker Feb 20 '17 at 17:48
  • 1
    @ash hey, how to build from source in windows? I couldnt find any detailed instructions for it. – Vishnudev K Mar 02 '17 at 09:19
  • 1
    It is a bit involved, but you can follow [the shell script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/ci_build/windows/libtensorflow_cpu.sh) that will be used to build the release binary for Windows in the next TensorFlow release (version 1.1). You can follow release progress in https://github.com/tensorflow/tensorflow/issues/7877 – ash Mar 07 '17 at 20:26

4 Answers4

2

This works for me when I added the native i.e tensorflow_jni.dll on PC or libtensorflow_jni.dylib on Mac(this should be the same for Linux distributions, not tested though) to my project root folder as seen here Adding Tensorflow to Java Project Netbeans. Though I'm using Intellij IDEA

olyjosh
  • 431
  • 7
  • 15
1

Not really an answer, but nevertheless I would like to warn you in advance.

The support for Tensor Flow is very experimental indeed. (February 2018) - You are still very dependent of Python.

Most importantly, there is no support for training networks in Java. You can only apply/run networks.

(Not even to mention the very limited number of available classes). If you do want to go ahead, I recommend you to take a look on Github because there are some utility classes there which will be more than useful for you. At least that will give you more comfort.

bvdb
  • 22,839
  • 10
  • 110
  • 123
1

java.lang.UnsatisfiedLinkError: tensorflow_native_libraries tensorflow_jni.dll: Can't find depedent libraries happens because of some Missing DLLs in Windows which tensorflow_jni.dll cannot seem to find.

  • Install Microsoft Visual C++ 2015 Resdistributable on Windows machine Download here

  • Try to close existing command prompts and then re-run the Tensorflow Java Program.

See below link for more details
https://github.com/tensorflow/tensorflow/issues/14456

Karan Kaw
  • 510
  • 1
  • 7
  • 15
-2

Add the below code in Maven pom.xml

 <dependencies>
   <dependency>
     <groupId>org.tensorflow</groupId>
     <artifactId>tensorflow</artifactId>
     <version>1.2.0</version>
   </dependency>
 </dependencies>

You can find the installation of tensorflow for java detailed description in below link https://www.tensorflow.org/install/install_java