10

I'm developing a standalone server (not a war) using Eclipse Juno. I run it as a Java application from Eclipse. After I've made some code changes, I want to stop the currently running server and start it up again. I do this tens of times a day.

The way I do that at the moment is as follows: - Go to the "Debug" tab. - Select the server process. - Click on the stop process icon (red square). - Click on the green arrow to re-run the last run application. - Go back to the "Java" tab.

Is there a quicker way?

Ideally, I'd like a button or keyboard shortcut that would stop and restart the application in one click. If it doesn't already exist, can I extend Eclipse in some way? Where should I look for an example of something like this?

ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66

4 Answers4

15

You can restart running application by right clicking it in debug window and selecting "Terminate and relaunch".

enter image description here

And quickly switching beetween views with Ctrl+F8

Also if you've already terminated the application from console, you can simply hit ctrl + f11

If you really want you can also add custom shortcut for terminating and relaunching by Window -> Preferences -> General -> Keys -> Find "Terminate and Relaunch" and choose your favorite key combination!

Ruuhkis
  • 1,924
  • 1
  • 27
  • 46
7

Eclipse Neon.1 added a way to terminate before relaunch by holding Shift while clicking on a launch history item.

You can also make that the default behaviour by enabling the option “Terminate and Relaunch while launching” in Preferences › Run/Debug › Launching.

https://www.eclipse.org/eclipse/news/4.6/platform.php#terminate-relaunch-history

hfs
  • 2,433
  • 24
  • 37
3

I had the exact problem you had. I had a simple Java class with a main method that runs an embedded tomcat.

When I change any of my service classes, I wanted to terminate the current embedded tomcat and relaunch with one single keystroke.

I know, I could have just clicked and done the same with 2 mouse clicks... but... it pained me enough to learn a wee wee bit about Eclipse plugin and threw something together.

Hope this helps you too.

https://bitbucket.org/mantis78/relaunch-plugin/wiki/Home

Boon
  • 1,871
  • 1
  • 21
  • 31
-1

Simply saying, You can't modify eclipse Like you wants to. But You can follow this procedure to minimize your effort 1. In Eclipse Project TAb-> Check Build Automatically. 2. And After Every Changes You are making Just Run The Project using Green button in eclipse.

Also you Can use CTRL+F11 to run project.

Amol
  • 26
  • 5
  • Yeah, I already have it build automatically on save. What I need is a way to stop the currently running application before starting it again. – ᴇʟᴇvᴀтᴇ Sep 17 '12 at 14:12
  • yes but like this, If Eclipse needs to restart it will get restarted Automatically(Or Eclipse Will ask you if you want to restart). Hence Like this You just need to Save changes And Run App, Eclipse will take care of everything Else – Amol Sep 17 '12 at 14:18
  • 1
    Ah, it's not the Eclipse application itself that I'm talking about, it's an application that I have run from Eclipse (using the big green arrow button). If I keep clicking on the green arrow or press Ctrl-F11 Eclipse will start multiple instances of my application. It doesn't shutdown the one that's running. – ᴇʟᴇvᴀтᴇ Sep 17 '12 at 14:20
  • 1
    Sorry I clicked Add Comment before I finished writing it... What I was saying was: If I keep clicking on the green arrow or press Ctrl-F11 Eclipse will start multiple instances of my application. (You can see them all running if you go to the Debug view). – ᴇʟᴇvᴀтᴇ Sep 17 '12 at 14:25