Failed to find mclmcrrt*.dll with Matlab Runtime - java

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.

Related

VTK/Java Wrapper in IntelliJ won't work because of linker errors (Can't find dependent libraries)

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

Java 64 bit Error "UnsatisfiedLinkError: The specified procedure could not be found"

My Java Application has JNI dll to be loaded at the beginning and we are using system.load() to load DLL with its full path. We have compiled the Java code with 64 bit JDK and dll we are trying to load is also compiled as 64 bit.
When i try to launch the Java application using java.exe at c:\windows\system32, it is successful in launching the application and when i try to launch the same Jar using the java.exe which is located in installed location i.e., %programfiles%\java\jre7\bin then it is failing with error "UnsatisfiedLinkError: The specified procedure could not be found".
Can anybody explain the difference between java.exe available in c:\windows\system32 and at installed location?
There is no difference between the two executables; They are one and the same. Your problem is your DLL location relevant to where you start the Java Environment.
The property java.library.path needs to modified to point to where your DLL is located. You can alter this property by passing -Djava.library.path=
Finally my problem is solved.
Actual problemis with libxml2. my applicat9on has dependency on libxml2. JRE 1.7.07 onards started using libxml2 and shipped into JRE location. hence there is conflict between different libxml2 DLLs. I have modified the application to load libxml2 dynamically and removed dependency.

Java - Failed to Load the JNI shared Library (JDK)

I am trying to launch an application (not Eclipse) that was written in Java. When I do, I get an error that says "Failed to Load the JNI shared Library (JDK)" along with a path that points to the location of the file.
From searching Google and StackOverflow, all I can find are people saying that the Java version installed needs to match my machine. My machine is 64 bit and so is my java installation, so I don't think that is my issue.
I have also verified that C:\Program Files\Java\jre7\bin is in my path variable. Also, just for the record, I do not use Eclipse. I have also tried uninstalling and reinstalling Java an the application that was written in Java. Lastly, the file it is complaining about exists on the machine.
Does anyone know what else could be the cause of this problem?
Update:
Thanks for your responses. I got it resolved, but the resolution seems like more of a hack and goes against what I was reading earlier. I installed the 32 bit version of Java 7 along side of my 64 bit version of Java 7. I then added the path the 32 bit version to the system path variable.
After I did this, the application was able to launch. Is there an issue with having both 64 bit and 32 bit versions of Java 7 installed simultaneously?
This is an error from your application. The application uses JNI. It is complaining that it cannot load it. Why it says (JDK) only its author knows. You will have to ask the author.
There is no problem having both versions of Java installed. However, the application you were using probably shipped with a 32-bit version of the JNI library. So, it needed to be used with a 32-bit Java JRE.

How to detect, prevent, and fix java windows registry corruption (i.e. "could not find java.dll")

Problem: java.exe complains about dll
We use a tool that copies-and-renames java.exe to a temp directory, i.e. /path/to/some/dir/java_foo_application.exe. [The tool is 'Yet Another Java Service Wrapper' or YAJSW. It copies-and-renames so that meaningful names show in the windows task manager ]
On some machines, corrupt java entries in the windows registry give this error when running this copied java.exe:
Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: could not find Java SE Runtime Environment.
Solved Once Before: Uninstall and reinstall
I've had this problem once before: nd solved it by uninstalling all jdk's -- using windows "add remove programs"-- and reinstalling a newer version of java.
Note that one of the jdk's would not uninstall. I had to download special registry cleaner from microsoft to force uninstallation.
My question: Detect and Prevent?
How can one tell in advance whether a system has corrupt java registry entries?
How to prevent this corruption for the future?
Any other ways to fix this aside from uninstalling and reinstalling the jdk's?
Thanks.
To find out what the real problem, download two jar files:
first and second
remember to set:
wrapper.console.pipestreams = true
Described on this page
The Wrapper log file shows me this trace:
-set state RESTART_START->RUNNING
-Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
has value '1.5', but '1.6' is required.
-Error: could not find java.dll
-Error: could not find Java 2 Runtime Environment.
process terminated
Controller State: WAITING -> PROCESS_KILLED
I solve my problem reinstalling System JRE 1.6.
Best regards!
Instead of messing with javaw you could use an executable wrapper to start your application. See for example exe4j or JSmooth.

Library not found: tibrvj

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.

Categories

Resources