issue when run deeplearning4J example - java

I am learning deep learning, and use deeplearning4J tuts.
But when i run example code, some issue there :
Caused by: java.lang.UnsatisfiedLinkError: no jnind4j in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:727)
at org.bytedeco.javacpp.Loader.load(Loader.java:502)
at org.nd4j.nativeblas.NativeOps.<clinit>(NativeOps.java:37)
... 18 more
i have tried some solutions on web but it doesnot work.
So, if you know how to fix it, help me.

You need to unzip cuda-9.1-7.1-1.4.1-windows-x86_64.jar and nd4j-cuda-9.1-1.0.0-beta-windows-x86_64.jar somewhere, and add the paths to the native dlls to the java.library.path property when launching your app.
For example:
-Djava.library.path=C:\<path where you unzipped>\cuda-9.1-7.1-1.4.1-windows-x86_64\org\bytedeco\javacpp\windows-x86_64;C:\<path where you unzipped>\nd4j-cuda-9.1-1.0.0-beta-windows-x86_64\org\nd4j\nativeblas\windows-x86_64

I had the same problem. But the issue was I was using the wrong import , nd4j-native. Instead of that I used nd4j-native-platform import and it fixed the problem.
Hope it helps.

I will try to answer this here, but usually this is where the chat comes in handy (a lot of asking about your environment and back and forth here..)
I'd try to answer this here, but the native code (especially with the examples) should run fine.
You could also try filing an issue: https://github.com/deeplearning4j/dl4j-examples/issues
In the mean time, read up on what an nd4j backend is:
http://nd4j.org/backend.html
This SHOULD be the only dependency you need to run:
http://search.maven.org/#artifactdetails%7Corg.nd4j%7Cnd4j-native-platform%7C0.6.0%7Cjar
The examples run out of the box for everyone we've talked to.
You don't seem to be doing anything out of the ordinary.
An alternative might just be using the nd4j-native artifact id with the appropriate classifier.
This is where you modify the nd4j backend:
https://github.com/deeplearning4j/dl4j-examples/blob/master/dl4j-examples/pom.xml#L64
You can try just getting rid of this and replacing it with 1 of the artifact ids I told you about. If that doesn't fix it, I would recommend coming in to gitter.
Please come in to gitter: https://gitter.im/deeplearning4j/deeplearning4j
for real time help.

Related

Using ops from Tensorflow.contrb on Windows via Java API

I would like to load an op from tf.contrib, specifically "_beam_search_ops". I use Tensorflow 1.6 from Maven.
Following the answer at Issue while loading/serving tensorflow model in java using estimators , I'm able to do so on Ubuntu 17.10.
The code looks like so:
TensorFlow.loadLibrary("_beam_search_ops.so");
Then I try to do the same in Windows 10 with code
TensorFlow.loadLibrary("_beam_search_ops.dll");
And it fails with
java.lang.UnsatisfiedLinkError: D:\Users\ALEXAN~1\AppData\Local\Temp\deep_api_plugin\_beam_search_ops.dll not found
at org.tensorflow.TensorFlow.loadLibrary(TensorFlow.java:47)
So what is the reason for this?
While I was writing and researching the question, I've stumbled on the solution.
In order to resolve the problem, a _pywrap_tensorflow_internal.pyd file should be copied to the folder where _beam_search_ops.dll resides. I understand that this is also some kind of dll, but do not understand why it is necessary for Windows and not for Ubuntu. If anyone happens to know, please enlighten me.
Also I understand that this sort of additional information should be provided in a comment to the original answer, but unfortunately I do not have enough reputation to comment and thought this answer could help someone.
Edit: I was too quick to celebrate. With this answer a library is loaded without exception, but the model cannot seem to use it, failing with
Exception in thread "main" org.tensorflow.TensorFlowException: Op type not registered 'GatherTree' in binary running on DESKTOP-EB6GIDR. Make sure the Op and Kernel are registered in the binary running in this process.
at org.tensorflow.SavedModelBundle.load(Native Method)
at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:39)
Search for answer should continue.

Getting "Could not initialize class sun.security.ec.SunEC" How to Proceed?

After coming back to a part of my code base that hadn't been touched for a few weeks, I got the rather terse message: "Could not initialize class sun.security.ec.SunEC" from my functional REST test cases.
I'm not making much progress figuring out how tackle this one, there's no other error information (no stack trace) and not much on the Internet. I expect an update has changed something since everything was working.
Does anyone have any suggestions or insight for fixing this one?
Ubuntu 16.10
Java 8, Oracle, "1.8.0_131"
The problem was caused by a missing library libsunec.so. I was using the alpine docker container V3.4 which contained the library, but when I upgraded to V3.5, a "glich" in my build process actually had me still using V3.4. When that was indirectly "fixed," and I unknowingly started using V3.5, the error was suddenly, and confusingly, uncovered because libsunec.so was left out of alpine V3.5. See: https://bugs.alpinelinux.org/issues/6809

How do I check a clients Java Version?

I want to create an Executable Jar file that when run, checks the currently installed version of Java on that computer and displays it for the user. I have searched online but in vain, I cannot find any code that allows a Jar file to check. I know that the Java website has it ( http://www.java.com/en/download/installed.jsp) I can't find a way to replicate it in Java Code. Any help would be very much appreciated.
Note: Sorry if this question is really stupid and has a really simple answer... I just spent half an hour trying to find a solution and I couldn't so I need your help! Thanks
Edit: I don't need the code for displaying it, just to get the version is enough for me thanks!
System.getProperty("java.version");
Calling System.getProperty("java.version"); will give you version of the installed JRE which is what you want. Also take a look at other System properties, you may find some of them also useful.

Problems with DefaultCacheServer when deploying Coherence REST

First of all, im a newbie in Java programming, since i'm actually a PHP Programmer not a Java Programmer. And my team want to build a system using PHP, and Coherence REST.
The first time, i tried to deploy it using using Glassfish, according the article from this url http://docs.oracle.com/cd/E24290_01/coh.371/e22839/rest_deploy.htm#BABBIIEE and i get this error "Trying to upload an illegal war archive. Make sure the archive file contains the descriptor file web.xml."
After that, i try to deploy manually according the article from this url http://docs.oracle.com/cd/E24290_01/coh.371/e22839/rest_example.htm#CHDBDGHG
And i got this error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/tangosol/net/DefaultCacheServer. Could not find the main class: com.tangosol.net.DefaultCacheServer. Program will exit.
Is there anyone who can help me to solve my problem?
Any information will be appreciated. Thanks
My bad, i already found out the solution. I have the wrong environment variables. Newbie mistake. thanks guys

Where can I find "Device" file to add to EclipseME java project?

I installed JavaME and EclipseME, and I'm trying to make a Hello World to my Nokia5530. But the imports are not working.
This page says that I need a "Device" file, but I don't know where to find it.. any idea?
Since it appears no on else is helping with this, I will start an answer, and put in my last comment into here.
OK, you need to install the Nokia SDK and then import it, as explained here, though your phone may not be series 60, you will need to d/l and then import the appropriate nokia sdk version: http://wiki.forum.nokia.com/index.php/Installing_Java_ME_development_tools_for_S60#Configuring_EclipseME
I haven't tried the suggestions here as I primarily develop on Windows at the moment, but the idea of using wine to install the SDK, and then move the files to an appropriate place on Linux sounds like a reasonable suggestion. I don't know if the suggestion below of compiling it yourself would be useful, but, there were some suggestions in the link below that may help you solve this particular problem.
http://www.wirelessforums.org/alt-cellular-nokia/nokia-sdk-linux-8895.html

Categories