如何在 Eclipse 中重新启动 Google App Engine Java 服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/800701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I restart the Google App Engine Java Server in Eclipse?
提问by bpapa
OK, maybe I'm dumb/blind, but in the docs it says "rebuild and restart the server." But I don't see a button to do this anywhere. Or from any contextual menu. And I can't find anything in their docs explaining how to do it. If I just try to start the app again, it gets angry because I already have App Engine running on the needed port.
好吧,也许我很笨/盲,但在文档中它说“重建并重新启动服务器”。但是我在任何地方都没有看到可以执行此操作的按钮。或从任何上下文菜单。而且我在他们的文档中找不到任何解释如何操作的内容。如果我只是尝试再次启动应用程序,它会生气,因为我已经在所需的端口上运行了 App Engine。
Only solution I've found is to restart Eclipse... any other ideas? A screenshot of a button would help if possible. :)
我找到的唯一解决方案是重新启动 Eclipse ......还有其他想法吗?如果可能,按钮的屏幕截图会有所帮助。:)
回答by Kai
In eclipse, there is a view that contains your Console. If you click on that, you will see the STDOUT and STDERR output of your running application. In the upper right, there should be a red box that will terminate the currently running program.
在 Eclipse 中,有一个包含您的控制台的视图。如果单击它,您将看到正在运行的应用程序的 STDOUT 和 STDERR 输出。在右上角,应该有一个红色框,它将终止当前正在运行的程序。
回答by miguelv
I have a different and possibly more productive solution for you. Like with most web development environments you probably want to change your source code and have Google Appengine server reload the new code for you.
我为您提供了一个不同且可能更高效的解决方案。与大多数 Web 开发环境一样,您可能希望更改源代码并让 Google Appengine 服务器为您重新加载新代码。
You need some version of the traditional "touch" unix command (if you work on windows you can download a version from here).
您需要某些版本的传统“touch”unix 命令(如果您在 Windows 上工作,您可以从这里下载一个版本)。
Then go to you project properties, Builders and add a new build step as a "Program". Under "Location" enter the path to your "touch" command ("D:\bin\UnxUtils\usr\local\wbin\touch.exe" for example - on Posix systems just "touch" should be enough since it's already in your PATH) and in "Arguments" put something like "${project_loc}/war/WEB-INF/appengine-web.xml". Also go to the "Build Options" tab and check "During auto builds".
然后转到您的项目属性,Builders 并添加一个新的构建步骤作为“程序”。在“位置”下输入“touch”命令的路径(例如“D:\bin\UnxUtils\usr\local\wbin\touch.exe”——在 Posix 系统上,“touch”就足够了,因为它已经在你的PATH) 并在“参数”中放置类似“${project_loc}/war/WEB-INF/appengine-web.xml”的内容。还要转到“构建选项”选项卡并选中“自动构建期间”。
"touch" will update the timestamp in you appengine-web.xml. When the App Engine server detects changes to you appengine-web.xml it will reload the app automatically. The load process is very fast so it can be done whenever you change any file in your project (which normally triggers the auto-build in Eclipse) - you can tweak the builder to only run when you change certain types of files.
“touch”将更新您 appengine-web.xml 中的时间戳。当 App Engine 服务器检测到对您 appengine-web.xml 的更改时,它会自动重新加载应用程序。加载过程非常快,因此可以在更改项目中的任何文件时完成(通常会触发 Eclipse 中的自动构建)——您可以将构建器调整为仅在更改某些类型的文件时运行。
回答by miguelv
I might add that the "little red box" is not always visible. It drove me crazy reading that same instruction but not seeing the terminate button until I discovered that the Console windows has "layers" that you can select from using the drop-down button on the far right of the controls for the Console view. You just need to go "back" to the console screen that says the server is running and you will see the little red terminate button.
我可能会补充说,“小红框”并不总是可见的。它让我疯狂地阅读相同的指令,但没有看到终止按钮,直到我发现控制台窗口具有“层”,您可以使用控制台视图控件最右侧的下拉按钮从中进行选择。您只需要“返回”到显示服务器正在运行的控制台屏幕,您就会看到红色的小终止按钮。
回答by dmiller309
The previous answer wasn't cutting the cheese for me. Upon first starting App Engine, the red square would be available above the text entry area. If I then clicked the run button again, then red square would go away and the console for the previous launch would be replaced by the console for the new launch. To manually stop the App Engine server, you can kill it from the terminal: http://geekbrigade.wordpress.com/2009/02/26/how-to-find-and-kill-a-process-that-is-using-a-particular-port-in-ubuntu/In short, "sudo netstat -lpn |grep :8888" and kill the service by process ID.
之前的答案不是为我切奶酪。首次启动 App Engine 时,文本输入区域上方将出现红色方块。如果我然后再次单击运行按钮,则红色方块将消失,上次启动的控制台将被新启动的控制台替换。要手动停止 App Engine 服务器,您可以从终端杀死它:http: //geekbrigade.wordpress.com/2009/02/26/how-to-find-and-kill-a-process-that-is- using-a-particular-port-in-ubuntu/简而言之,“sudo netstat -lpn |grep :8888”并通过进程 ID 终止服务。
Strangely, adding Google Web Toolkit to the project made my App Engine launch show up in the Development Mode pane, where it could be easily be killed or restarted.
奇怪的是,将 Google Web Toolkit 添加到项目后,我的 App Engine 启动显示在开发模式窗格中,很容易被终止或重新启动。
回答by Marco Garozzo
Just Click on Debug perspective (should be on upper right panel), select the instance of web application on Debug panel (if you don't show it, you could enable by menu Window->show view->Debug) and click on red box of view menu.
只需点击 Debug 透视图(应该在右上角的面板上),在 Debug 面板上选择 web 应用程序的实例(如果你不显示它,你可以通过菜单 Window->show view->Debug 启用)并点击红色视图菜单框。
回答by Ajax
If you include the gwt SDK in your project, the gwt development mode box contains a reload server button that will work just fine.
如果您在项目中包含 gwt SDK,gwt 开发模式框包含一个重新加载服务器按钮,它将正常工作。
回答by chrismarx
The best I've found is to setup the keyboard shortcuts for the console's terminate button, and the run/debug start/restart command. By default, you can enable Command-F2 to terminate, and Command-F11 to restart, its fairly painless. Make sure to enable the full debug menu group (click on main toolbar -> customize, etc)
我发现的最好的方法是为控制台的终止按钮和运行/调试启动/重新启动命令设置键盘快捷键。默认情况下,您可以启用 Command-F2 终止,并启用 Command-F11 重新启动,这相当轻松。确保启用完整的调试菜单组(单击主工具栏 -> 自定义等)