Home » Software Development » Terminate and Relaunch in Eclipse

About Rudiger Herrmann

Terminate and Relaunch in Eclipse

A few days ago a new feature was committed to the Eclipse repository: Terminate and Relaunch. When enabled, Eclipse will terminate all currently running processes of a launch configuration before relaunching it.

This feature is particularly useful if the process to launch holds a unique system resource. For example, a servlet container that listens on a particular port will throw a BindException if that port is in use by a previously launched instance. With the Terminate and Relaunch, setting enabled, these types of errors will be a thing of the past.

To use the new feature, enable the option on the Run/Debug > Launching preference page like shown below.

terminate-and-relaunch-preferences

And that’s it. Whenever you restart a launch configuration through the main toolbar, all active processes of that launch configuration will be terminated first.

In order to temporarily toggle the preference setting, you can hold down the Shift key while selecting the Run or Debug button.

Note, however, that Terminate and Relaunch is restricted to the Run and Debug toolbar buttons. Using the key bindings F11 or Ctrl+F11 for example will not consider this preference. I have added a corresponding request in the bug tracker and hope that this unfortunate limitation will be fixed before the final release.

The feature will be available in Eclipse 4.6 (Neon) M7. If you can’t wait that long, it is already included in I-builds >= 20160417, available from here:

By all that activity in Eclipse, I wasn’t lazy either. If you use the Launch Dialog from the Extras for Eclipse package, the Terminate and Relaunch option will also be considered. And there is no need to wait for a new version of Eclipse either. The feature is also available for all recent versions of Eclipse (4.4/Luna or later). You can even change the preference from within the dialog’s drop-down menu:

terminate-and-relaunch-launch-dialog

To be compatible with the upcoming version and older versions of Eclipse, Extras for Eclipse uses the same preference key as the new Eclipse feature.

Extras for Eclipse with support for Terminate and Relaunch, can be installed or updated from this software repository:

or drag the icon to your running Eclipse to install from the Eclipse Marketplace

If you would like to share your thoughts and experiences on this topic, please leave a comment or open an Eclipse bug report or an Extras for Eclipse issue.

Reference: Terminate and Relaunch in Eclipse from our JCG partner Rudiger Herrmann at the Code Affine blog.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

 

and many more ....

 

Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions

 

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments