繁体   English   中英

调试远程Java应用程序-

[英]Debugging Remote Java Application -

我正在尝试调试Java应用程序。 我按照这个步骤

错误:

   Failed to connect to remote VM. Connection refused.
   Connection refused: connect

程序:

   package test;

   public class test {

   public static void main(String[] args) {
    // TODO Auto-generated method stub
    System.out.println("Got");
   }
  }

脚步:

 Eclipse --> Run --> Debug Conf --> connect tab  --> test is project name 
 --> host is localhost --> port is 8000 --> Socket Attach --> Apply --> 
 Debug under common tab --> apply

它向我显示了该错误。 然后我检查了以下内容

ping localhost - Works
telnet localhost 8000 - connection refused
netstat -tna | grep 8000 - no process is listening

我该如何实现? 我还应该修改什么? 还是有其他方法可以实现这一目标?

主机:localhost Windows

如果要连接到远程应用程序,则必须以“调试”模式启动该应用程序。 否则您将无法连接。

您必须为此设置-xdebug选项,并确保在连接到应用程序时,它以某种方式可用。

 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

这样就可以连接了。

如果您可以从eclipse中启动程序,那就容易多了。 只需使用

  • 右键单击您要开始的课程(您的主课程)
  • 调试为-> Java应用程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM