Restart an application in Eclipse

时间秒杀一切 提交于 2019-12-08 15:55:41

问题


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?


回答1:


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

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!




回答2:


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




回答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




回答4:


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.



来源:https://stackoverflow.com/questions/12460745/restart-an-application-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!