I am trying to setup a Java project on a Windows computer that invokes R code using rJava/JRI. I have installed JDK 1.8, R 3.5.3 and rJava library in R on my computer. I have added the following to my Pathvariable: D:\Program Files\R\R-3.5.3\bin\x64; D:\Program Files\R\R-3.5.3\library\rJava\jri\x64. I have also configured the Build Path in Eclipse by adding the three JAR files from the jri folder as external JARs and by changing the native library to D:/Program Files/R/R-3.5.3/library/rJava/jri/x64. These are the same steps that I've recently done on another Windows computer and afterwards the R test script worked perfectly. However, on my current computer I keep getting the following message:
Please make sure that the JRI native library is in a directory listed in java.library.path.
java.lang.UnsatisfiedLinkError: D:\Program Files\R\R-3.5.3\library\rJava\jri\x64\jri.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
at rtest.main(rtest.java:61)
Any idea what's going wrong? I would be really greatful for any help.
EDIT: Here is what my Build Path looks like:
EDIT2: Additionally, I have now copied all .DLL files from D:\Program Files\R\R-3.5.3\bin\x64 together with jri.dll to D:\Program Files\Java\jdk1.8.0_201\bin as recommended here. Still no luck.
Please try this one:
Run As -> Run Configuration -> Set Environment Variables ->New
Name : PATH
Value: C:\Program Files\R\R-3.6.1\bin\x64;C:\Users\[Username]\Documents\R\win-library\3.6\rJava\jri\x64;
Ok, I got it. After having done everything that is listed in the first post, I also copied all .DLL files from D:\Program Files\R\R-3.5.3\bin\x64 together with jri.dll from D:\Program Files\R\R-3.5.3\library\rJava\jri\x64 to D:\Program Files\Java\jre1.8.0_201\bin (in addition to the JDK folder). Now the test script works. Thanks to everyone who tried to help!
Try this:
Right click on project > Java Build Path (here you can look your
libraries and import libraries)
Try do a clean and build
Check your JDK
If you have others eclipse installed on your computer look your file eclipse.ini and check than your JDK is correctly linked
I resolved this after coming across this bug report:
https://www.mail-archive.com/openjfx-dev#openjdk.java.net/msg22016.html
"As previously mentioned, the above exception is not thrown on machines where the Visual C++ 2019 redistributable is installed."
I downloaded the MS Visual C++ redistributable for 2015-2019 and installed it on two different computers with diff combinations of offAdoptJDK, jre_8u_202, and jre_8u_265, and this resolved my issue.
I downloaded the redistributable from the link below:
https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
For Windows 10, I installed "x64: vc_redist.x64.exe" above and then my program ran successfully.
Related
I've created a Matlab's function that I want to call from a Java App. Since I don't have matlab installed in this machine I use Matlab Runtine (version 8.5, 32 bits).
When I execute the code, I get this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the required library mclmcrrt8_5.dll on java.library.path.
This library is typically installed along with MATLAB or the MCR. Its absence may indicate an issue with that installation or the current path configuration.
The MCR version that this component is trying to use is: 8.5.
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:259)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:265)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:270)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.get(MCRConfiguration.java:71)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.<clinit>(MCRConfiguration.java:81)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getMCRRoot(MCRConfiguration.java:86)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ModuleDir.<clinit>(MCRConfiguration.java:60)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getModuleDir(MCRConfiguration.java:65)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1503)
at BCI.BCIMCRFactory.newInstance(BCIMCRFactory.java:60)
at BCI.BCIMCRFactory.newInstance(BCIMCRFactory.java:71)
at BCI.Class1.<init>(Class1.java:104)
at bci.pruebaEEG.main(pruebaEEG.java:24)
I've included to my PATH environment's variable the dll's path:
C:\Program Files (x86)\Matlab\Matklab Runtime\v85\runtime\win32
Matlab's version used to create the previous function was R2015a (32bits) and to compile the Java Package, jdk 1.7 (they're supposed to be compatible).
Can anyone help me??
Thanks in advance!
Okay, I was able to find the solution to my dll's problem. So, if someone else is also getting continuously this "Failed to find the required library mclmcrrt8_5.dll on java.library.path." error and has already followed this steps, please check if your jre version matches with the 32/64 bits version of the matlab compiler (MCR)
I was running my Java application from Eclipse and fool of me I didn't realize I was using (x64) jre7 instead of (x86). I just had to download the correct one and add it to the JRE System library. Now everything runs perfectly.
I am trying to use the 64 bit rxtx serial communication library (downloaded from cloudhopper) with 64bit windows 7 and eclipse. I get the message:
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path. The dlls are in the /jre/lib dir as well as the Windows/System32. The RXTXcomm.jar is in the build path for eclipse as well as in the jre/lib/ext dir. I ran process monitor in the background and and see that RXTXcomm.jar, rxtxSerial.dll, and rxtxParallel.dll are all found and have been opened, So I am unclear as to why this problem is occurring.
Any suggestions.
Go to Project -> properties -> Java build path ->Find your .jar.
Click on + to open the JAR's properties.
Select Native library location and edit it to point to RXTX's shared library (.DLL, .so, .dylib).
You can install librxtx-java package from repo for Ubuntu.
You can also add a virtual machine argument:
-Djava.library.path=c:\path\to\dll\
or
-Djava.library.path=/path/to/lib/
That worked for me. Also refer to this question.
Windows user : my problem was actually that I was placing the rxtxSerial.dll and the rxtxParallel.dll files in the wrong directory.
In my case, they were in [...]/jdk1.7.0_09/bin/ instead of [...]/jre7/bin/, although paths may differ for different versions of Java.
After all it's logic, if we want our JAR to run outside our IDE, we must have the dlls in our java running environment, not in our development environment :)
I resolve this problem by adding rxtxSerial.dll[jre 1.8.0_45/bin] and RxTxcomm.jar[jre 1.8.0_45/lib/ext]
Hy, I had the same problem when integrating the RXTXcomm into Netbeans under Ubuntu 11.10.
I am guessing that you are not copying the files in the right place, at least that was my problem.
Under Ubuntu java is installed under usr/lib/jvm. BUT here I had a lot of forders (ex java-7-openjdk-i386, java-7-common, java-6-openjdk ...). In Netbeans I check what is the path of the JDK included into the project, it was java-7-openjdk-i386 . so I took the rxtxSerial.so (under windows it is rxtxSerial.dll) and copied it to java-7-openjdk-i386/jre/bin and it worked like a charm .
I hope this helps.
I was having the same problem even after installing the RXTXcomm.jar in the Java\jdk\lib directory. Based on the instructions at http://www.jcontrol.org/download/readme_rxtx_en.html
I located the rxtxSerial.dll and the rxtxParallel.dll files. Placing them in the bin directory did not help, but placing them in the lib directory along with the RXTXcomm.jar solved the problem.
I had the same problem. So I installed JDK 32-bit and added those RxTx files(x86) to Program files(x86)/java/... folder instead of Program files/java... folder. Also I added those RxTx .dll files(x86) to /System32 folder. After that the problem was resolved in my application.
FIXED:
when using IDE such Netbeans it has it's own directory for the JRE, were you probably installed your RXTX drivers, but when running the JAR file outside your IDE this error occurs...
Solution is install the RXTX drivers also inside the JAVA JRE directory which use to run all your JAR files.
Under Netbeans 5.5 on Windows, I needed to right-click Libraries under
Projects on the left hand side of the screen, and select "Add
JAR/Folder", picking the RXTXcomm.jar file. Only then did my
enter code here
become a valid command.
Also, I got a run-time error where it failed to load the
rxtxSerial.DLL library because it couldn't find it. I needed to
right-click the project name, select properties, select Run under
categories, and add a VM Options: entry of
-Djava.library.path="C:\where-ever-you-stuck-rxtxSerial.DLL-file;%PATH%
Example:
-Djava.library.path="C:\rxtx-2.1-7-bins-r2\Windows\i368-mingw32\;%PATH%"
While I'm sure there is more than one way of adding the directory to
your path, this worked for me. Note I did the default NetBeans 5.5/JDK
1.6.0 isntall accepting all the default options(ie clicking next until I got to finish), so I haven't modified my java paths or anything.
Alternatively you can copy the *.dll into C:\Windows\System32\, Java
will find it there automatically.
Note that you cannot use the 32bit DLL when running a 64bit JRE:
You will get an error similar to:
Can't load IA 32-bit .dll on a AMD 64-bit platform thrown while loading gnu.io.RXTXCommDriver
To solve this simply install the 32bit JDK and add a new Platform in
Netbeans under Tools->Java Platforms->Add Platform and change the
project settings to use the newly created platform. make sure you type
"import gnu.io.*"
from http://rxtx.qbang.org/wiki/index.php/Using_RXTX_In_NetBeans
I had the same issue, on windows 10 and eclipse, the probelm was i had java for 32 and 64 bits, so i installed RXTX library for 64 bits but eclipse was using the 32 bits java enviroment, so what i did was download RXTX for 32 bits copy the necessary files to C:ProgramFilesx86/JAVA_HOME as in the instructions for RXTX and the problem was solved. Hope this helps anyone.
I had same problem. I was trying to run built jar file from dist folder and it was not working even it was working from NetBeans IDE. I copied rxtxSerial.dll file in dist folder where my main jar file was and it started working fine.
I was having this error before:
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while
loading gnu.io.RXTXCommDriver
Exception in thread "Thread-7" java.lang.UnsatisfiedLinkError: no rxtxSerial in
java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.smslib.helper.CommPortIdentifier.<clinit>(CommPortIdentifier.java
:72)
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java
:69)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:277)
Im running Java 1.8.0_065 (64 Bit) on Windows 10 (64 bit). I've downloaded the latest cmake version (3.4.0-rc2) for windows and the latest VTK sources (6.3.0). I generated a VS2015 solution via cmake and set up everything (seemingly!!) successfully using this tutorial:
https://www.particleincell.com/2011/vtk-java-visualization/
When I try to run the DemoJavaVTK.java which is provided by the tutorial I get linker errors in IntelliJ. (14.1.5) At apperently every VTK library that has to be loaded there is the same error:
java.lang.UnsatisfiedLinkError: C:\Program Files\VTK\bin\ANY_VTK_DLL.dll: Can't find dependent libraries at
java.lang.ClassLoader$NativeLibrary.load(Native Method) at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938) at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854) at
java.lang.Runtime.loadLibrary0(Runtime.java:870) at
java.lang.System.loadLibrary(System.java:1122) at
vtk.vtkNativeLibrary.LoadLibrary(vtkNativeLibrary.java:223) at
vtk.vtkNativeLibrary.LoadAllNativeLibraries(vtkNativeLibrary.java:158)
at sample.DemoJavaVTK.(DemoJavaVTK.java:54) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:264) at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Mind that ANY_VTK_DLL is just a placeholder. Concrete examples would be: vtkViewsContext2DJava.dll or vtkRenderingVolumeOpenGLJava.dll.
The path should be correct. All the "versions" are 64 bit. I compiled VTK for 64 Bit. I'm running a 64 bit OS with 64 bit java.
The wierdest thing is: Using eclipse everything works fine and I can run the VTK-demo without any problems. Also I'm using VTK for a course at my university, I'm working on my project with a colleague who has the same java and intellij version. He also used the same tutorial to set up VTK/Java. And the example also works in IntelliJ for him. The only difference I can tell between his and my system is, that he is using Windows 8.1 and I am using windows 10.
I really don't know where to continue from here. What is IntelliJs problem?
Got it fixed out of pure randomness by manually setting the JRE via the Run-configurations:
http://puu.sh/l3315/7c1d5e3393.png
Why does this work?
Update:
The UnsatisfiedLinkError denotes that the Java Virtual Machine (JVM) cannot find an appropriate native-language definition of a method declared as native. Specifically, in order to find the required native library, the JVM looks in both the PATH environment variable and the java.library.path system property. (Got from this article)
I used to have this kind of problems mostly because two causes:
The native librarie cannot be found (i.e don't exist)
The library being linked is not the same (Debug vs Release, 32 bit
vs 64 bit, VC10 vs VC9, etc.)
The library is already loaded by your application and the application tries to load it again
The native library is present either in the java.library.path or in the PATH environment library of your application
In order to be sure to whom library you are linking use Dependency Walker. Using this tool will make you understand what's wrong by telling you to which native libraries you are linking to.
Download the tool and then open C:\Program Files\VTK\bin\ANY_VTK_DLL.dll to see to which library it's linking to and where they are in your machine. Then make sure that IntelliJ can find these paths.
Here is a good tuto on how to use this tool: http://www-archive.mozilla.org/quality/help/dependency-walker.html
If they are the correct ones, verify the class path that IntelliJ Idea uses to launch your application to check that the native libraries are there.
I could run using,
System.setProperty("vtk.lib.dir", YourBuildVTKLibPath);
I am new using VTK, took me a while to fix this, I am using eclipse ,
I added to the PATH environment variable the dll folder and the lib folder
The problem
I've been trying to run a unit test on my own Mac. The test runs fine on Linux servers, but fails locally with the following trace:
java.lang.UnsatisfiedLinkError: no fedel_client in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
....
What I've tried
Copy the .so file from the server
I've copied fedel_client.so from the server to /workspace/dapper/java/lib/native/macosx on my local machine, and added it to the java.library.path:
-Djava.library.path=/workspace/dapper/java/lib/native/macosx:...
Create a symlink
I've created a symlink from fedel_clinet to fedel_clinet.so, in case that Java is looking for the former (without the .so extension).
Add the .so directory to .bashrc
I've tried adding .so directory to PATH:
PATH=$PATH:/Users/adamatan/workspaces/trunk/dapper/java/lib/native/macosx
And to LD_LIBRARY_PATH:
export LD_LIBRARY_PATH="/Users/adamatan/workspaces/trunk/dapper/java/lib/native/macosx"
Print the java.library.path
I've printed java.library.path, to see if the changes in the Eclipse environment were propagated to the JVM:
System.out.println(System.getProperty("java.library.path"));
And got:
/workspace/dapper/java/lib/native/macosx:....
The exact values I placed in the Eclipse configuration.
Debugging ideas?
I got the exact same error with all the aforementioned solutions. Any idea how to debug this problem? Can I get a more verbose error message from Java? Is the file not found, or not loaded? If it isn't loaded, why is that?
I may be reading you wrong, but it sounds like you've copied the native library (libfedel_client.so) from the Linux server to your own Mac. If this is the case, this will certainly not work. You cannot use a Linux native library on your Mac, you will need to recompile it on the Mac to produce a libfedel_client.dylib.
Depending on the version of the Apple Java runtime you're using, you may need to use the .jnilib extension. Early runtimes used the .jnilib extension instead of .dylib, and both extensions are still supported (although .dylib is now the default.)
I'm running a Java application on a Linux server that uses Tibco RV and I get the following error:
TibrvException[error=901,message=Library not found: tibrvj]
What is causing this problem?
I have already added lib path containing *.so into LD_LIBRARY_PATH but still the same result.
UPDATE:
Currently, I have <MyApp>/libs/tibrvj.jar added into classpath. The tibrvj.jar was copied from Windows environment to the Linux box where I'm running my application. I removed this from the classpath and added another reference <TibcoDirectory>/libs/tibrvj.jar and it FIXED the problem. They have different sizes with the previous file and there's probably a difference between the one copied from Windows and the one currently in the Linux box. Can someone explain why is this so?
I had the same problem, and I fixed it doing the following:
File tibrvj.jar is present in the classpath of my application
File tibrvj.dll is present via java library path. This file is usually located at bin directory in Tibco Rendezvous home directory (e.g. C:/tibco/tibrv/8.2/bin)
The installed java version is compatible with the installed tibco version.
My environment is:
Windows 7, 64bits
Tibco Rendezvous 8.2, 64bits
JDK 1.6u29, 64bits
Before, I had installed a JDK 1.6u17, for a i586 processor and when I tried to load the library using:
System.loadLibrary("tibrvj");
I got this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\TIBCO\tibrv\8.2\bin\tibrvj.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
It gave me the clue to instal the correct java version.
Have you loaded the library using System.loadLibrary("tibrvj")? Have you added it to java.library.path?
Use :
java -Djava.library.path=/opt/tibco/tibrv/lib -cp {}.jar
LD_LIBRARY_PATH=/opt/tibco/tibrv/lib export LD_LIBRARY_PATH
Then **System.loadLibrary("tibrvj");**
The answers by rchavarria and DaveHowes helped, but for me the problem was that my IDE was overriding the PATH variable (and hence java.library.path) when running my project.
Removing this override made it work, as outside the IDE tibrv was already on the PATH.
Are you using Wrappers?
Do you have java.library.path set in your wrapper.conf?
I had java.library.path set in wrapper.conf, correct this value fixed the issue for me.