I am developing a Flex-based game, and struggling with SmartFox Server.
Anyway, it's a java-based server for Flash platform games, and it's kind of clunky to develop with on Windows. So, I want to be able to start it (and stop it) via Eclipse rather than the current batch file nastiness they provide.
The problem is I've never done that with a non-standard server that didn't just have a server adaptor in Eclipse.
I know it should be pretty simple, but how do I do it? It's really just a matter of calling a command line executable with some arguments, or even just running it as a Java application without its executable shell. Killing it would just be a matter of killing the process in Eclipse.
Also of note is that I want to make sure I have the shell output in Eclipse for debugging purposes.
I would think you could run it as an "External Tool" from Eclipse (the little green arrow with the toolbox). Click on the menu arrow to the right of that icon and select the "Configure External Tools" option.
You can then right click on the "Program" tree-node (on the Left hand side) and select "New" to create a new configuration. You will need to fill in the values similar to what you would do if you were running the server on the command line.
Give your configuration a meaningful name, like "SmartFox" or something.
Location is the command that is run (might point to java in your case).
To get the console setup, click on the "Common" tab and the "Allocate Console" checkbox should already be checked.
Once you are done, press the "Apply" or "Run" button.
You can then start the server by selecting it from the "External Tools" list (same icon as earlier) and you can stop it using the red stop icon on the console (should work).
Optional... the other tabs of the configuration dialog may be useful. You might want to have the build tab not do a build before launch, depending on how you have things set up.
What this wont give you (necessarily) is the tight integration between the server and Eclipse. You may have to do additional configuration or just deploy your code to the server as necessary.
Hopefully I am not way off base of what you were looking for.
Good luck.
Related
I usually develop mobile apps for iOS and Android and I am used to launching projects repeatedly without asking if another instance is running or not, since the simulators will handle this for me.
When I use Eclipse to develop desktop apps, I face this problem since running multiple times the same project will result in multiple different instances. I would like Eclipse to be able to kill the previously-opened processes before running the new one. I've found this question, but this one addresses the problem to let a single instance of a Java application run, but this is not quite the point. I do not care if the final release will run one or two times, I just want to be able to run a single instance when developing, seamlessly like Xcode or Eclipse for Android do. Moreover, that solution will popup an alert when running the same project twice, but that's not a solution for me. Kill and run, that it.
Is it possible to change the run configuration of the project to achieve this without changing the source code, or is this achievable with a plugin or whatelse? I would like to find a completely automated solution that could make me work as if I were under Xcode.
No, it is not possible to change the Eclipse run configuration so that Eclipse stops existing instance before running new instance.
As an alternative, you might try setting a keyboard shortcut for "Terminate" action.
What is the short cut in eclipse to terminate debugging/running?
Is there a keyboard shortcut for stopping the current console in Eclipse?
As a general solution to this, try:
Goto Window->Preferences, search for Launching.
Select the "Terminate and Relaunch while launching" option.
Press Apply.
Not sure if it would work while developing Android (not very common in Eclipse now), but good option to know.
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?
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!
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
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
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.
I'm developing using IntelliJ 11u on a spring mvc application using tomcat.
I tried the maven jetty plugin, but after a few builds I keep getting java permGen issues and then it just hangs. I was told this was because spring uses log4j and it has some sort of leaks?
Anyhow, I'm asking for tips to help fire up a server, tomcat, with my updated code so I can make quick updates and have tomcat reloaded.
Here are my current annoyances with tomcat:
Only code changes seem to get auto-reloaded, if I make changes to my view pages things don't get updated unless I redeploy. The maven jetty plugin seems to map to my view pages directly and I saw updates to my view pages instantly w/o it even redeploying.
if I have more than 1 thing running in intelliJ, like say I have a main program that I run, or a unit test, IntelliJ seems to re-order what gets run in the run drop down menu and also the shortcut keys get changed to the last thing I ran.
I use google chrome, for some reason when I start tomcat it brings firefox to the forefront and opens a new tab each and every time.
If someone can address any or all of the above issues that would be great as I hate this dance I have to go through just to update/redeploy my application. I wish it could just be a consitant method, using shortcuts or automatically without me having to close the tab created in firefox, and then minimizie it, or redploy for a simple view change etc.
You should configure IDEA to update classes and resources and enable a checkbox in the Run configuration to do it automatically on frame deactivation.
Browser can be changed in IDEA settings and you can disable opening browser at all in Tomcat Run/Debug configuration.
As for the Run panel tabs order, you can pin tabs using the tab right click menu, in this case they will remain in the Run or Debug panel in the order they were created.
Look at JRebel if you want an even more productive environment (It costs, but I find it is worth it). As you can see here, http://zeroturnaround.com/jrebel/features/, it increases the types of changes you can hot-swap (no waiting for a build). I am currently evaluating it myself and will probably pick up a full license.
BTW, if you develop in scala (it looks like you're not, but just in case) the plugin is free.
I'm trying to work in Eclipse as much as possible without a mouse. I cannot find a key binding for starting and stopping servers quickly in Eclipse WTP (Web Tools Platform).
One way to start a server is to switch to the package explorer (Alt+Cmd+Q P), select the project (up/down arrows) and then the "debug on server"-key binding (Shift+Alt+D R on the Mac). But this requires way too many steps.
I found a method that reduces starting a server down to two keystrokes (after some easy initial setup).
the tl;dr:
f11, enter.
you will likely need to do some setup to get this working:
Be sure you have a run/debug configuration defined for tomcat.
Click the run menu at the top of the window
Click Debug configurations...
Choose Apache Tomcat from the menu on the left
If there's not already a server defined there, click "new launch configuration" (top left) and choose the correct server from the select menu on the right pane (you must already have a tomcat server defined in your servers view)
save all that, go back to a file in your project and press f11 (First required keystroke).
if you get an error message that says something "could not find any code that could be executed on a server", then you either messed up the first step, or possibly your server is already running.
a dialog will pop up, the top choice being "Run on Server". Press enter (this is the 2nd required keystroke)
If this is your first time, you'll see another dialog after this which asks you to choose a server. Choose the server you want to run it on (you probably only have one), and check "always use this server when running this project" and you'll bypass this window in the future.
tip: you'll quickly notice that as a bonus, it will open up a web browser pointed at your server. you can change which browser it uses in windows->preferences->general->web browser.
and then there you have it. two keystrokes to start your server - f11, enter.
stopping it is another story. i haven't found a good way other than clicking the stop icon in severs or console. if you do, let me know...
While I don't perform the same steps as you to run my projects, I have created custom key-bindings to navigate around the eclipse environment. If you go to Eclipse Preferences > General > Keys, you will be able to map the majority of tasks to key-bindings that make the most sense to you.
One process you could perhaps follow is this:
Open package explorer via shortcut
Perform a 'Collapse All' on the tree (reduce vertical navigation in step 3)
Up/Down to your project
Run shift-alt-D, R to Debug on your server
If you have 'Link with Editor' turned on, when you go to edit a file again your tree will expand based on the context of your work.
CTRL+ALT+R to restart
CTL+ALT+S to stop
If u look in Help > Key assist (Ctrl+shift+L), You can see a shortcut named Tomcat start,stop.
The shortcut is Ctrl+Alt+T by default.
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.
Only solution I've found is to restart Eclipse... any other ideas? A screenshot of a button would help if possible. :)
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.
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.
You need some version of the traditional "touch" unix command (if you work on windows you can download a version from here).
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".
"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.
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.
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.
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.
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.
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)
If you include the gwt SDK in your project, the gwt development mode box contains a reload server button that will work just fine.