Open tomaspiaggio opened 3 years ago
I just tested the same code on my mac and it worked perfectly. Could there be an issue with Windows specifically?
Did Maven download tensorflow-core-api-0.3.1-windows-x86_64.jar
to your local Maven cache? That jar should contain jnitensorflow.dll
and tensorflow_cc.dll
. It's available here - https://repo1.maven.org/maven2/org/tensorflow/tensorflow-core-api/0.3.1/.
I just checked and they are being correctly downloaded:
The files were contained in this folder structure:
Does it end up in the classpath that Maven/your IDE generates when you run the program?
Running these lines
Arrays.stream(((URLClassLoader) ClassLoader.getSystemClassLoader()).getURLs())
.map(e -> e.getFile())
.forEach(System.out::println);
yields the following output
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/charsets.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/deploy.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/access-bridge-32.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/cldrdata.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/dnsns.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/jaccess.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/jfxrt.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/localedata.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/nashorn.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/sunec.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/sunjce_provider.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/sunmscapi.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/sunpkcs11.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/ext/zipfs.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/javaws.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/jce.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/jfr.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/jfxswt.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/jsse.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/management-agent.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/plugin.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/resources.jar
/C:/Program%20Files/Java/jdk1.8.0_261/jre/lib/rt.jar
/C:/Users/[...]/target/classes/
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-platform/0.3.1/tensorflow-core-platform-0.3.1.jar
/C:/Users/Tomas/.m2/repository/org/bytedeco/javacpp/1.5.4/javacpp-1.5.4.jar
/C:/Users/Tomas/.m2/repository/org/bytedeco/javacpp/1.5.4/javacpp-1.5.4-linux-x86_64.jar
/C:/Users/Tomas/.m2/repository/org/bytedeco/javacpp/1.5.4/javacpp-1.5.4-macosx-x86_64.jar
/C:/Users/Tomas/.m2/repository/org/bytedeco/javacpp/1.5.4/javacpp-1.5.4-windows-x86_64.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1.jar
/C:/Users/Tomas/.m2/repository/com/google/protobuf/protobuf-java/3.8.0/protobuf-java-3.8.0.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/ndarray/0.3.1/ndarray-0.3.1.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1-linux-x86_64.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1-macosx-x86_64.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1-windows-x86_64.jar
/C:/Program%20Files/JetBrains/IntelliJ%20IDEA%202020.2/lib/idea_rt.jar
Filtering with "tensor" keyword like this
Arrays.stream(((URLClassLoader) ClassLoader.getSystemClassLoader()).getURLs())
.map(e -> e.getFile())
.filter(e -> e.indexOf("tensor") > 0)
.forEach(System.out::println);
results in the following
/C:/Users/[...]/target/classes/
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-platform/0.3.1/tensorflow-core-platform-0.3.1.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/ndarray/0.3.1/ndarray-0.3.1.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1-linux-x86_64.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1-macosx-x86_64.jar
/C:/Users/Tomas/.m2/repository/org/tensorflow/tensorflow-core-api/0.3.1/tensorflow-core-api-0.3.1-windows-x86_64.jar
Ok. Comparing the published artifacts for tensorflow-core-api it looks like the Windows one is missing tensorflow_framework, but I'm not sure if that's necessary on Windows as it might be compiled into the other binaries. @saudet do you know why the set of Windows dlls that are packaged is different?
@tomaspiaggio There's probably some missing dependency somewhere. I've bundled a couple more DLLs in JavaCPP 1.5.6, so please try to upgrade javacpp-platform and see what that gives. Other than that, we can usually figure out what it's looking for with tools like Dependencies: https://github.com/bytedeco/javacpp-presets/wiki/Debugging-UnsatisfiedLinkError-on-Windows
@Craigacp It's not possible to export all symbols on Windows, so the C++ API is limited there, that's normal.
Host description
Simple project to replicate the problem
Problem description
The main method is straight out of the docs here. I can't seem to make it work. My main language of choice is Scala. I was trying to make it work in sbt and was getting a similar exception. From what I searched on the internet, it seems to be a JavaCPP error (missing
*-platform
). I don't think I'm doing anything wrong as I copied the example project. Please correct my if I'm wrong.