I used the Matlab deployment tool to build a matlab code into a java project. I am having some problem with the Matlab-Java interface, the error while running the java code is:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to
find the library mclmcrrt7_15.dll, required by MATLAB Builder JA, 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: 7.15.
When I type "version -java" in the Matlab console, the answer is Java 1.6.0_17-b04. So,I changed my Path in the system settings to ...\Files\Java\jdk1.6.0_33\bin But since I have Java version-7 installed, It is not using version-6. In command prompt, when I checked the version of java and javac, I saw that the version of javac is 1.6 but that of java is 1.7. I also made a CLASSPATH environment variable and a JAVAHOME variable and set it to 1.6. Could you please tell me how do I change the java version being used by the system to 1.6 so that matlab can interact with it?
I think this is the problem, but I am just guessing from the error message. Please let me know if the problem is something else, and not just the incompatibility in java versions.
Is the DLL mclmcrrt7_15.dll on the PATH anywhere?
For Java to be able to load a DLL, the DLL needs to be in a folder listed in the java.library.path system property. The default value for this property on Windows is the PATH environment variable.
Just fix the same error on my machine.
In my case, it is fixed by add the MATLAB path into the SYSTEM environment variables:
add in PATH
-C:\Program Files\MATLAB\R2011a\bin;
-C:\Program Files\MATLAB\R2011a\runtime\win64
Wish it is helpful.
Related
I was super confused about compatibility on a java tool I was using and ended up downloading different versions of java so now I do not know what versions of jdk or jre I am actually using. When I compile I use -- release 8 in my command prompt, what does that exactly mean?
Currently my programs folder has jdk-18 in the java folder
and my program files(x86) folder has
jdk1.6.0_45
jdk 1.7.0_80
jre 1.8.0_ 321
jre6
jre7
My java home environment variable is C:\Program Files\Java\jdk-18
My classpath has the file C:\Program Files (x86)\Java\jdk1.7.0_80\lib\tools.jar
when I type java -version in my command prompt I get
java version "1.8.0_321"
Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
Java HotSpot(TM) Client VM (build 25.321-b07, mixed mode)
So does that mean my cmd uses jre 1.8.0_ 321? What about the jdk? How do I change it if I need to?
When you run java -version - first java found in PATH environment variable is used. To be sure use commands where java (Windows) or which java (Linux) - it will tell you the location.
When you run mvn install - JDK found in JAVA_HOME environment variable is used. To be sure use mvn -version - it will tell you the location.
When you run from IDE - IDE settings matter, usually you specify JDK per project.
When you run javac --release 8 Something.java you are asking compiler to produce output compatible with the version you specified - it has nothing to do with JDK you are actually running it on. This flag was added in JDK 9, so if it doesn't fail for you then it means you are running on JDK>=9.
If you want to be 100% sure just fully qualify the path - for example on Windows "C:\Program Files\Java\jdk1.8.0_152\bin\javac.exe" Something.java
So does that mean my cmd uses jre 1.8.0_ 321?
Yes.
What about the jdk?
Unclear.
Run javac -version and that will tell you what version compiler you will run by default.
The versions of the Java tools that you get when you type java, javac, jar (etcetera) at the CMD prompt are solely determined by the PATH environment variable setting in effect at the command prompt.
The other variables do other things ... but not this.
How do I change it if I need to?
If you want to change what typing java does, change PATH.
Note that the PATH variable is a standard Windows environment variable that affects all* commands, not just the Java tools. There should be lots of tutorials on how to set PATH, and on the Windows CMD prompt in general. You should probably take the time to read them.
You can also just use the absolute path for the Java tools; e.g. "C:\Program Files (x86)\Java\jdk1.7.0_80\bin\java.exe" is probably the correct path for the Java 7 java command. (You can easily check ... and find the correct path by looking at the installation tree.)
Regarding your other variables:
My java home environment variable is C:\Program Files\Java\jdk-18
That is presumably JAVA_HOME. That tells (many) 3rd-party tools which Java tools to use. But unless you have configured PATH to depend on JAVA_HOME, it won't alter what typing java does.
My classpath has the file C:\Program Files (x86)\Java\jdk1.7.0_80\lib\tools.jar
That is presumably CLASSPATH. That variable provides a default path that java will use to find classes to load. For example, if you run java com.acme.Example, it will use CLASSPATH to search for the compiled Example class.
So "C:\Program Files (x86)\Java\jdk1.7.0_80\lib\tools.jar" is almost certainly incorrect. (That JAR file contains the classes that implement various Java tools. It doesn't need to be on the classpath, unless your Java application is running one of those tools. And even then there would need to be other things on the classpath for your application to work.
You need to do some reading on what the Classpath is, how it works, and how to set it correctly. Setting it to stuff randomly is a sure fire way to make your Java code not work ...
I compiled C++ code with gcc 4.8.2 (which is c++11 version and it is necessary for my C++ code) and generated a libmy.so file. I want to call the method in libmy.so from Java code with JNI, and I have set LD_LIBRARY_PATH to be the path of libmy.so. When run Java code, errors info is like below:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
.../libmy.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not
found (required by libmy.so)
Because this Linux machine is common used, I don't want to modify files in /usr/lib64 (e.g., modify the link of libstdc++.so.6).
By the way, my JDK version is 1.8, I tried JDK 1.11 and it also failed.
It seems that Java can't load the right version of libstdc++.so.6 (also for libc.so), but I am not sure.
How to fix this problem? Thanks a lot!
I want to use JMatLink to connect Java with Matlab. I need to use this specific library since it is integrated in the projeny code. I have followed the steps from the documentation / other forums:
downloaded the source code from sourceforge
unzipped it
copied the JMatLink.dll into C:\Windows\System32
added the path of matlab\bin and matlab\bin\win64 to my system environment variables
However, when I try to run the class SimpleGuiTest, I get the following error message:
ERROR: Could not load the JMatLink library
Win: This error occures, if the path to
MATLAB's <matlab>\bin directory is
not set properly.
Or if JMatLink.dll is not found.
Linux: Check if <matlab>/extern/lib/glnx86 (libeng.so, libmat.so, etc.)
and <matlab>/sys/os/glnx86 (libstdc++-libc6.1-2.so.3) are in your path.
(you can also copy missing libraries to your local path).
and
Exception in thread "main" java.lang.UnsatisfiedLinkError: jmatlink.CoreJMatLink.setDebugNATIVE(Z)V
I have changed the code where the library gets loaded from
System.loadLibrary("JMatLink");
To a command with absolute path
System.load("C:\\Windows\\System32\\JMatLink.dll");
But I am still getting the same error message. Is it possible that the .dll is not compatible with my Win 8.1 and Matlab R2014a environment? Do I have to compile a new one for my environment? Or is there anything else that I am missing?
I've also tried to install it without any luck a while back. I belive the reason is, as you state, that the .dll is not compatible with 64-bit operating systems/Matlab. If I remember correctly, a few of the dependencies it requires some 32-bit system libraries which was not found in my version of Windows 7 (64-bit). To map the missing dependencies I used dependencies-walker.
I had a go at compiling the source code as well, but you need to have an older version of Matlab6.5 (according to the build file) in order to compile it with the accompanying build file. More modern versions of Matlab such as 2014a does not have support for the aging borland compiler used by the build file. When trying to compile the library with Borland 5.5.1, MatlabR2012b, JavaSE1.4.2 it gives me the error:
compile:
[exec] Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
[exec] Error E2194: Could not find file 'Files\MATLAB\R2012b\extern\include.cpp'
[exec] Error E2194: Could not find file 'Files\MATLAB\R2012b\simulink\include.cpp'
It might be that you can find a way to build it with a modern supported compiler or if you get your hands on an older version of Matlab, but at this point I gave up that approached and created a wrapper using the matlabcontrol-fork matconsolectl.
Hope my experience has been helpful in some way.
When I open adt-bundle-windows-x86_64-20131030 and click on the Eclipse.exe application to install it I get the message; A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java Virtual Machine was found after searching the following locations: C:\users\username\desktop\development\adt-bundle-windows-x86_64-20131030\eclipse\jre\bin\javaw.exe
javaw.exe is your current PATH.
I do have JDK, and JRE on this computer, I need them to view the emulator for my job. I have tried uninstalling and reinstalling Java with the same results. What can I do to fix this problem?
You will have to put Java in your classpath, so Eclipse knows where it can find Java. See here: http://docs.oracle.com/javase/tutorial/essential/environment/paths.html for info on how to do this.
install 32 bit version of jdk from oracle website
put the path of your java bin directory under Environment variables.
System->Advanced System Settings->Environment Variables->path
Open command prompt. use java and javac commands to know if you have successfully installed java and compiler.
if it doesn't help, this question has a lot of helpful answers
Eclipse - no Java (JRE) / (JDK) ... no virtual machine
From what you said:
"'java' is not recognized as an internal or external command, operable program or batch file"
Your java may not have been installed correctly, or, it was installed, but you did not set path to it correctly. It is not a problem with ADT, any of your programs that need Java will not be able to find it.
I am exploring a trial version of Adobe's Technical Communication Suite. Following this video, I am trying to generate an Android app using a sample document.
I've tried changing the file paths for the JDK and apache.ant files, but keep receiving the same error message (see below).
BUILD FAILED
C:\Program Files (x86)\Android\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml:713: The following error occurred while executing this line:
C:\Program Files (x86)\Android\adt-bundle-windows-x86_64-20130522\sdk\tools\ant\build.xml:727: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files (x86)\Java\jre7"
I got the same error but in a linux system and solved it by knowing that: JDK is a super command for JRE.
JRE: Java Runtime Environment only runs not compile or build (eg. using ant).
JDK: compiles and runs.
So try changing your java setting to JAVA_HOME= ..../java OR .../jdk not .../jre.
It seems that you didn't configure your JAVA variable environment.
BTW, I don't know what IDE you are using. As far as I know, if you have more than one java versions in your computer, in eclipse you should set variables.
(1) window->preference-> left column (Java)->Compiler, you could change different compiler version.
(2) And in left column (Java) -> Installed JRE, you should also modify the JRE version.