title: How can I write a Java application that can update itself at runtime?
body: <p>I would like to implement a java application (server application) that can download a new version (.jar file) from a given url, and then update itself at runtime.</p>
  
  <p>What is the best way to do this and is it possible?</p>
  
  <p>I guess that the application can download a new .jar file and start it. But how should I do the handover, e.g. know when the new application is started and then exit. Or is there a better way to do this?</p>