如何调试我从MATLAB环境调用的Java源代码? [英] How do I debug my Java source code that I am calling from the MATLAB environment?

查看:183
本文介绍了如何调试我从MATLAB环境调用的Java源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据以下链接:



http://www.mathworks.com/matlabcentral/answers/102080



为了调试从MATLAB环境调用的Java代码,请使用以下步骤:


  1. 使用命令提示符下的-jdb标志重新启动MATLAB。例如:



    matlab -jdb



    (默认情况下,此标志将启用端口VM中的调试支持4444)


  2. 您可以从Java IDE(如Eclipse和Intellij)启动Java调试器,也可以从系统命令提示符调用jdb。 MATLAB显示消息JVM正在启动调试启用并提供适当的信息。例如:



    jdb-connect com.sun.jdi.SocketAttach:port = 4444


  3. 附加调试器后,您将能够像通常那样设置断点。


任何人都可以更详细地解释这些步骤,特别是步骤3?如何附加调试器(假设我正在使用eclipse)。



谢谢

解决方案<




  • 将您的java项目导入eclipse(可能没有,但这样更容易)

  • 将您的java项目配置为使用与MATLAB版本相同的JRE。也许你必须安装它,因为Matlab有一个捆绑版本(不需要调试,但需要修改和重新编译)

  • 创建一个新的启动配置进行调试,设置IP和端口。 / li>
  • 运行配置,附加到现有应用程序。


Based on the following link:

http://www.mathworks.com/matlabcentral/answers/102080

In order to debug Java code being called from the MATLAB environment, use the following steps:

  1. Relaunch MATLAB using the -jdb flag from a command prompt. For example:

    matlab -jdb

    (by default this flag will enable debugging support in the VM on port 4444)

  2. You can either launch a Java debugger from a Java IDE such as Eclipse and Intellij, or call jdb from the system command prompt. MATLAB displays the message "JVM is being started with debugging enabled" and provides the appropriate information. For example:

    jdb -connect com.sun.jdi.SocketAttach:port=4444

  3. After attaching the debugger you will be able to set breakpoints as you normally would.

Can anyone explains these steps more detail, especially for step 3? How to attach the debugger (Assuming I'm using eclipse).

Thanks

解决方案

3) in details.

  • Import your java project to eclipse (possible without, but easier this way)
  • Configure your java-project to use the same JRE your matlab-version uses. Maybe you have to install it because Matlab has a bundled version (Not required to debug, but required to modify and recompile)
  • Create a new launch configuration for debugging, set IP and Port.
  • Run the configuration, to attach to an existing application.

这篇关于如何调试我从MATLAB环境调用的Java源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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