-1

I want to use jdde in MATLAB. I have pretty-tools-JDDE-1.0.2.jar on my computer. Here is my code in MATLAB:

javaaddpath('C:\test\pretty-tools-JDDE-1.0.2.jar');
conversation = com.pretty_tools.dde.client.DDEClientConversation();

I get the error:

Undefined variable "com" or class "com.pretty_tools.dde.client.DDEClientConversation".

However, when I call the javaclasspath function, the jar file is listed under "DYNAMIC JAVA PATH". Why do I get this error? What is the correct way?

user1719360
  • 193
  • 6
  • 1
    Do a google search sometimes. [matlab central](http://www.mathworks.com/matlabcentral/answers/43801). – angainor Oct 04 '12 at 08:30

1 Answers1

0

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

If you don't have writing privilege on your matlabroot, then you added 'C:\jdde\' to a copy of librarypath.txt that now resides in your startup folder. JavaDDEx64.dll which is located. Now found by MATLAB.

Ami
  • 4,241
  • 6
  • 41
  • 75
  • I can get it to work if I add the jar file to the static java path and the dll to the library path. However this requires to edit the text files and to restart MATLAB. My MATLAB programm needs to run on any computer, editing txt files and restarting MATLAB is not an option. – user1719360 Oct 04 '12 at 08:28
  • http://stackoverflow.com/questions/4376565/java-jpa-class-for-matlab/4380605#4380605. see this post for how to dynamically load java classes using ClassPathHacker.java. – Ami Oct 04 '12 at 08:33