在Eclipse之外的Eclipse中调用调试会话

时间:2010-06-01 03:24:32

标签: eclipse debugging jdb

如何在Eclipse中运行调试会话但是在Eclipse之外调用它(而不是运行Run-> Debug我想调用一些将在Eclipse中启动调试的进程(可能是jdb?))。这可能吗?

1 个答案:

答案 0 :(得分:1)

如该线程所示,可以通过远程调试(参见remote debugging) 即:它不会自动为您启动Eclipse。您必须启动Eclipse会话并listen to the port used for remote debugging

  

我刚刚尝试从Ant构建文件运行程序,然后使用Eclipse连接到它。工作得很好。
  我的测试:

 <project default="remote">
  <target name="remote">

   <java classname="B" fork="true">
    <classpath>
     <pathelement path="bin" />
    </classpath>
    <jvmarg value="-Xdebug" />
    <jvmarg value="-Xnoagent" />
    <jvmarg value="-Djava.compiler=NONE" />
    <jvmarg
 value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" />
   </java>

  </target>
 </project>
  

我在Eclipse外部启动了Ant构建,尝试使用address = 8000   [...]。此外,由于我的应用程序需要很长时间才能启动,因此我在启动Ant后几乎连接了Eclipse它显示了一些线程并被拾起。