title: Eclipse Plugin Action: Attach Eclipse debugger to a Remote Java Application programmatically
body: <p><em>Sorry, this question is a duplicate of <a href="http://www.eclipse.org/forums/index.php?t=msg&amp;goto=659018&amp;S=c1fded7d78fc80dbea998b91c2539d25" rel="nofollow noreferrer">this post</a> inside the Eclipse forum. As the Eclipse forum seems not to be very responsive, i'm trying my luck here. I already implemented this functionality with NetBeans, <a href="https://stackoverflow.com/questions/4459828/control-netbeans-from-commandline-attach-debugger-from-shell-script">as described here</a>, but now I need the same functionality for Eclipse.</em></p>
  
  <p>In my development environment, a remote Java Server that i have to debug changes his IP address very often (I cannot change that fact). So i often have to change the IP-Address of that Server in my Eclipse Debug Configuration, where i have to update the address of the Remote Java Application.</p>
  
  <p>I'm able to find out the IP address programmatically (it can be read from a property file), so i would also like Eclipse to use that "dynamic" IP address, without having to type it manually into the GUI everytime the address changes.</p>
  
  <p>The first question is: Do i even need to write an Eclipse plugin to model this use case? Or can i use a command line parameter, which controls a running Eclipse instance? What i would really like would be if i can trigger Eclipse from commandline, passing the IP address to Eclipse which should than attach the Debugger, like the following "pseudo"-command:</p>
  
  <pre><code>eclipse --debugger.attach.remote;address=192.168.178.111:9009
  </code></pre>
  
  <p>This way i could trigger Eclipse to attach it's Debugger from an external program, with the IP as an argument (Which is what I already implemented with NetBeans).</p>
  
  <p>Second question: If i have to write a plugin for this (which should just provide one simple button, which triggers the lookup of the IP in the property file and then requests Eclipse to attach it's Debugger to this IP), how can i start? Can you suggest me the Eclipse module that i should access to control the Eclipse Debugger and maybe some documentations/examples/tutorials how to use it? What would be EXTREMELY great would be a code snippet which shows how to attach the Eclipse Debugger inside an Eclipse Plugin.</p>
  
  <p>Thanks in advance for every hint!</p>
  
  <p>I already found <a href="http://dev.eclipse.org/newslists/news.eclipse.platform.pde/m%20sg01325.html" rel="nofollow noreferrer">this quite related post</a> :
  But it just gives a small hint, wich classes i can use. But i would rather see an code example, so i still appreciate some help.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As I already plan to write a bigger Eclipse-Plugin-Suite with several functionalities for my daily work (and I want to learn developing Eclipse plugins in general), I don't want to workaround this problem through e.g. the hosts file (although it's a really nice and simple approach). As I asked, I want to attach the Debugger from within an Eclipse Plugin.</p>