Using Java API gives "no nativemvm in java.library.path"
Ältere Kommentare anzeigen
I am attempting to work through the example code for the Java Matlab engine API (Note: this is calling Matlab FROM Java): https://www.mathworks.com/help/matlab/matlab_external/java-example-source-code.html
I can get to the last step, then I get the error: "java.lang.UnsatisfiedLinkError: no nativemvm in java.library.path". FYI I get this same error when trying to run my own code linked to Matlab in Eclipse.
Does anyone know how to fix this? Or know of any other information/examples/tutorials on calling the Matlab engine from Java? (This is a very new feature in 2016b so there is not much information out there)
1 Kommentar
Michaela Rikard
am 5 Okt. 2017
I am having the same problem. I have added the matlabroot/bin/maci64 to both the PATH and DYLD_LIBRARY_PATH and am getting the same error: no nativemvm in java.library.path. It seems like people have been able to get this to work by adding to the PATH in Windows. Has anyone had success on a Mac?
Antworten (5)
Jim Person
am 13 Jan. 2017
2 Stimmen
6 Kommentare
Adriano Ferreira
am 6 Feb. 2017
Thank you awesome work. It helped allot
Manuel Rios
am 21 Feb. 2017
Can you show me , any of your codes ? @Jim Person
import com.mathworks.engine.*;
public class CNN
{
public static void main(String[] args) throws Exception{
MatlabEngine eng = MatlabEngine.startMatlab();
double[] a = {2.0 ,4.0, 6.0};
double[] roots = eng.feval("sqrt", a);
eng.close();
}
}
I was trying to compile that code which is an example from mathworks but Eclipse says that it has an error in feval function due to th arguments that Im using
Manuel Rios
am 21 Feb. 2017
I added matlabroot\bin\win64 to my Computer envirioment variables but now this error appers: Exception in thread "main" java.lang.UnsatisfiedLinkError: com.mathworks.mvm.MvmFactory.nativeSetJavaEngine(Z)V
Help Please
Jose Cano
am 13 Mär. 2017
I am blocked with the same error : "com/mathworks/mvm/MvmFactory.nativeSetJavaEngine(Z)V" Any help would be greatly appreciated.
happy
am 24 Mai 2017
Came across this, having the same error: com/mathworks/mvm/MvmFactory.nativeSetJavaEngine(Z)V
May I know how you resolved it?
Thank you!
SK
am 26 Jun. 2017
I am also having this error--has any one been able to figure out a solution?
Thanks for the help!
J.Eric Tkaczyk
am 13 Feb. 2017
2 Stimmen
This also worked for me, but I had to first exit and restart my IntelliJ IDE after changing the PATH on the Windows Environment Variables
1 Kommentar
Christoph Müller
am 21 Jun. 2017
I still have this problem (also with IntelliJ IDE) despite changing the PATH on the WIndows Environment Variables. Could you please explain hoe you were to solve this issue step by step? It seems that I am missing something here. Thanks!
ant
am 23 Mär. 2017
2 Stimmen
you need to add the matlab library to your IDE(eclipse or others) or System (if you don't use any IDEs ), see below:

that's the right solution.
2 Kommentare
Manuel Rios
am 20 Apr. 2017
Where did you find this info ?
sahar alhaddad
am 28 Sep. 2017
Bearbeitet: sahar alhaddad
am 28 Sep. 2017
Thank you. it works in STS.
Chibing Gng
am 20 Feb. 2017
0 Stimmen
matlabroot/extern/engines/java/jar/engine.jar
But in my computer I do not have the above files for 2016b.Please tell me how to fix it.
Kobe Van Reusel
am 15 Mär. 2017
0 Stimmen
I'm having the same problem but can't find the solution for it.
I added the path to my PATH variable and added the engine.jar to my library but stil it gives me the "no nativemvm in java.library.path" error.
Can someone explain all the steps he took to get it working? Is it important where the engine.jar file is located or can i put it in the working directory of my project?
I'm using osx with netbeans and downloaded Matlab R2017a.
1 Kommentar
Bo Li
am 15 Mär. 2017
This is a quote from the file "<matlabroot>/extern/examples/engines/java/README" for Mac:
Run the examples by adding "<matlabroot>/bin/maci64" to the Java library search path without setting the DYLD_LIBRARY_PATH variable:
java -Djava.library.path=<matlabroot>/bin/maci64 -classpath .:<matlabroot>/extern/engines/java/jar/engine.jar EngineConsoleDemo
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!