Can't import Java library jdde in MATLAB

9 ビュー (過去 30 日間)
852053843
852053843 2012 年 7 月 17 日
回答済み: Karthik Wakshe 2022 年 5 月 4 日
I'm trying to use jdde, but I can't access the classes in the jar file from MATLAB:
javaaddpath('C:\jdde\pretty-tools-JDDE-1.0.2.jar')
conversation = DDEClientConversation();
I get the following error:
??? Undefined function or variable 'DDEClientConversation'.
According to the documentation and the many examples I've looked at this should work. How do I use this library in MATLAB? What is my mistake?
Edit:
I tried adding the package to my static class path, but now I get the following error:
>> conversation = com.pretty_tools.dde.client.DDEClientConversation();
Warning: A Java exception occurred trying to load the com/pretty_tools/dde/client/DDEClientConversation class:
Java exception occurred:
java.lang.UnsatisfiedLinkError: no JavaDDEx64 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 com.pretty_tools.dde.client.DDEClientConversation.<clinit>(DDEClientConversation.java:382)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.mathworks.jmi.OpaqueJavaInterface.findClass(OpaqueJavaInterface.java:470)
??? Undefined variable "com" or class "com.pretty_tools.dde.client.DDEClientConversation".

採用された回答

Malcolm Lidierth
Malcolm Lidierth 2012 年 7 月 17 日
JavaDDEx64 looks like a shared library/dll which cannot be found. You need to add it to the library path. A quick way, if you have access, is just to put a copy in your matalbroot()/bin/$arch folder ($arch will be macos/win64 etc).
  1 件のコメント
852053843
852053843 2012 年 7 月 17 日
Thanks, this was the solution! Since I don't have writing privilege on my matlabroot, I added 'C:\jdde\' to a copy of librarypath.txt that now resides in my startup folder. JavaDDEx64.dll which is located there is now found by MATLAB.

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

その他の回答 (2 件)

Srikrishnan
Srikrishnan 2014 年 6 月 14 日
I am facing a similar problem. I have a JAR file(fbsc.jar) with two class files. They are both based on another JAR file which I am able to successfully inport and use. When I import the class files of fbsc.jar in JAVA and use it I am able to do it succesfully. However when I do it in MATLAB(2012a) I get the error undefined function or variable.
I have added it in the dynamic path. Still no use. I am not able to figure out what am I doing wrong. I have been stuck on it for days now and still no progress.Any kind of help would be appreciated. Thanks
  1 件のコメント
Malcolm Lidierth
Malcolm Lidierth 2014 年 6 月 22 日
R2012a uses Java 6 by default. Has fbsc.jar been compiled with a later Java version?

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


Karthik Wakshe
Karthik Wakshe 2022 年 5 月 4 日
Exception in thread "Thread-6": java.lang.UnsatisfiedLinkError: C:\Users\Admin\Desktop\MATLAB\R2022a\bin\win64\nativedmatlab.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.mathworks.toolbox.distcomp.nativedmatlab.NativeMethods.<clinit>(NativeMethods.java:7)
at com.mathworks.toolbox.distcomp.ui.desk.RunBatchJobActionProvider.lambda$initialize$0(RunBatchJobActionProvider.java:58)
at java.lang.Thread.run(Thread.java:748)
I am facing this issue how should i resolve this?

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by