在IntelliJ中调试我的代码 [英] Debugging my code in IntelliJ
问题描述
我正在使用JBoss和IntelliJ。我在intellij之外运行Jboss。即在命令提示符下运行。如果是这种情况,我可以在IntelliJ中调试我的代码
I am using JBoss with IntelliJ. I am running Jboss outside intellij. i.e running in Command Prompt. If that is the case, Can I debug my code in IntelliJ
推荐答案
您可以调试任何正在运行的JVM,甚至可以调试远程不同的JVM计算机通过JDWP。首先,您需要准备JBoss(同样适用于任何JVM)以侦听给定TCP / IP端口上的调试器连接:
You can debug any running JVM, even remote on a different computer via JDWP. First you need to prepare JBoss (same thing applies to any JVM) to listen for debugger connections on a given TCP/IP port:
-Xdebug -Xrunjdwp:server=y, transport=dt_socket,address=5005, suspend=n
必须将这组参数添加到Java选项中,在JBoss启动脚本中查找 JAVA_OPTS
变量。完成后,JBoss将侦听5005端口以进行调试器连接。 JBoss控制台启动后的第一行应该是:
This set of parameters has to be added to Java options, look for JAVA_OPTS
variable in your JBoss startup scripts. Once this is done, JBoss will listen on 5005 port for debugger connection. The very first line in JBoss console after starting it up should be:
Listening for transport dt_socket at address: 5005
现在您可以选择以下方式附加您的IntelliJ:
Now you can attach your IntelliJ by choosing:
- 运行
- 编辑配置
- +(添加)
- 远程
-
localhost
/5005
没问题
- Run
- Edit configurations
- "+" (Add)
- Remote
localhost
/5005
are fine
这篇关于在IntelliJ中调试我的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!