Using Java API gives "no nativemvm in java.library.path"

41 ビュー (過去 30 日間)
Jim Person
Jim Person 2017 年 1 月 13 日
コメント済み: Michaela Rikard 2017 年 10 月 5 日
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 件のコメント
Michaela Rikard
Michaela Rikard 2017 年 10 月 5 日
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?

サインインしてコメントする。

回答 (5 件)

Jim Person
Jim Person 2017 年 1 月 13 日
Answering my own question: I used the suggestion to add matlabroot\bin\win64 to the PATH permanently using the Windows UI, instead of temporarily in Eclipse/cmd, and the code compiles now (the example problems and my own).
  6 件のコメント
happy
happy 2017 年 5 月 24 日
Came across this, having the same error: com/mathworks/mvm/MvmFactory.nativeSetJavaEngine(Z)V
May I know how you resolved it?
Thank you!
SK
SK 2017 年 6 月 26 日
I am also having this error--has any one been able to figure out a solution?
Thanks for the help!

サインインしてコメントする。


J.Eric Tkaczyk
J.Eric Tkaczyk 2017 年 2 月 13 日
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 件のコメント
Christoph Müller
Christoph Müller 2017 年 6 月 21 日
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
ant 2017 年 3 月 23 日
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 件のコメント
Manuel Rios
Manuel Rios 2017 年 4 月 20 日
Where did you find this info ?
sahar alhaddad
sahar alhaddad 2017 年 9 月 28 日
編集済み: sahar alhaddad 2017 年 9 月 28 日
Thank you. it works in STS.

サインインしてコメントする。


Chibing Gng
Chibing Gng 2017 年 2 月 20 日
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.
  2 件のコメント
Manuel Rios
Manuel Rios 2017 年 2 月 21 日
Chibing Gng
Chibing Gng 2017 年 2 月 21 日
Thanks.

サインインしてコメントする。


Kobe Van Reusel
Kobe Van Reusel 2017 年 3 月 15 日
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 件のコメント
Bo Li
Bo Li 2017 年 3 月 15 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCall MATLAB from Java についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by