MATLAB: Can’t import Java library jdde in MATLAB

classesjavajddeMATLABpackages

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".

Best Answer

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).
Related Question