当我尝试使用java包jdde时,MATLAB挂起,但是系统重新启动后才会第一次 [英] MATLAB hangs when I try to use the java package jdde, but only for the first time after a system reboot

查看:289
本文介绍了当我尝试使用java包jdde时,MATLAB挂起,但是系统重新启动后才会第一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MATLAB中的外部java包 jdde 。请注意,对于以下示例,包附带的DLL文件需要在MATLAB库路径上。根据您的MATLAB版本,这样做的方法是不同的。



在MATLAB中使用jdde可以正常工作,除非我重新启动计算机后第一次或者我注销/登录在Windows中。当我在计算机重新启动后第一次运行以下代码时,MATLAB将永远保持在忙模式(使用0%CPU)。当这种情况发生时,我在任务管理器中杀死MATLAB进程并重启MATLAB。当我再次运行相同的代码时,它将立即执行(不会永远保持繁忙)。

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

总而言之,上述代码将导致MATLAB在第一次运行时永远保持繁忙系统重新启动或用户注销/登录后。当我在杀死MATLAB进程后再次运行它,它将工作得很好(不挂起MATLAB)。



我在不同的计算机上看到这种行为, MATLAB版本(2010和2012)。我正在使用Windows 7 x64。



在代码示例中,a.connect命令是导致MATLAB永远保持繁忙的命令。将此命令放在try / catch块中将不会有帮助,因为a.connect不会导致错误,它永远不会继续。



我不是确定这个问题是由MATLAB还是由java包引起的。
任何想法如何摆脱这种行为将不胜感激。



注意:a.connect的输入参数并不重要,它将永远挂起,所以我只是在这个例子中作为输入。

解决方案

代码在DdeInitialize()方法中没有任何知道的原因挂起。新建JDDE-2.0.3包含此问题的解决方法。


I'm using the external java package jdde in MATLAB. Please note that for the following example, the DLL file that comes with the package needs to be on the MATLAB librarypath. The method to do this is different depending on your MATLAB Version.

Using jdde in MATLAB works fine, except for the first time after I reboot the computer or I logoff/logon in Windows. When I run the following code for the first time after a computer reboot, MATLAB will stay in busy mode forever (with 0% CPU). When this happens, I kill the MATLAB process in the task manager and restart MATLAB. When I run the same code again, it will execute instantly (not staying busy forever).

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

To sum it up, the above code will cause MATLAB to stay busy forever the first time I run it after a system reboot or user logoff/logon. When I run it again after killing the MATLAB process, it will work perfectly fine (not hanging up MATLAB).

I have seen this behavior on different computers, and in different Versions of MATLAB (2010 and 2012). I'm using Windows 7 x64.

In the code example, the a.connect command is the one that causes MATLAB to stay busy forever. Putting this command in a try/catch block would not help, because the a.connect doesn't cause an error, it just never does continue.

I'm not sure if this problem is caused by MATLAB or by the java package. Any ideas how to get rid of this behavior would be much appreciated.

Note: The input argument of a.connect does not matter, it will always hang, so I just gave '' as input in this example.

解决方案

Code hangs without any know reason in DdeInitialize() method. New build JDDE-2.0.3 contains workaround for this problem.

这篇关于当我尝试使用java包jdde时,MATLAB挂起,但是系统重新启动后才会第一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆