Running a specific project when I hit Run in eclipse - eclipse

In Netbeans I have the option of setting a "Main Project" which basically means if you hit "run", it will automatically execute the main class for that project.
This is convenient for various reasons, for example if you have one project depending on another project and you want to quickly test your changes in your main project.
Does a similar concept exist in eclipse?
Currently, I click on the desired project and then ctrl+F11 to run that project, but it would be convenient if I could just hit F11 or something without the extra action.

I had that same problem. My workaround is to make eclipse always launch the previously launched application. You can do that in settings, Run/Debug | Launching, in the Launch Operation section, select:
[x] Always launch the previously launched application
When you want to launch something different, launch it explicitly, and after that you can relaunch easily with Control F11.
This is very useful for me in practice, as most of the time I work on one thing and relaunch it several times, and rarely need to switch between launchers. (As an aside: in IntelliJ it's nice that I can easily switch between launchers using a simple drop-down list, without manually navigating to the other project/thing I want to switch to.)

Related

Shortcut for selecting run configuration in Eclipse IDE

I have an Eclipse workspace with a bunch of projects. I manually created some run configurations for each project (it's necessary to pass some arguments to VM, so I can't just run it directly, e.g. using shortcut ALT+SHIFT+X, T in the specific file).
Most of the time, I just use one run configuration (whereas for the first time I manually launch it using Run -> Run configurations -> (name) -> Run). Since I configured Eclipse to always run the last run configuration (on F11 or CTRL+F11), it's usually enough.
However, sometimes I need to switch to a different run configuration and then back to previous one and then to a different one etc. Is there a quick way to do it? I'd like to see a shortcut, which would display pop-up window with all existing run configurations. By typing first few letters, I'd find an appropriate one and would be able to immediately run it by pressing ENTER. I mean something similar to what CTRL+SHIFT+T or CTRL+SHIFT+R looks like.
I'm afraid there's not something like that. Nonetheless, any advice on how to get more effective would be greatly appreciated, because I'm bored of switching run configurations via menu (as I described above). I can press ALT+R, N and then select a run configuration using arrow keys, but it's not really that comfortable.
You already gave most of the answer yourself. Start by pressing ALT+R, N and then simply start typing the name of the configuration you want. The cursor should be positioned in the filter field and thus incrementally reduce the list of launch configurations as you type. When you've narrowed it down to 1, complete the selection by ALT+R.
BTW: thanks for the reminder, I, too, was using the mouse way too much in this particular use case. I will stop doing so, now that I gave the answer :)
Since Eclipse 4.12 (June 2019, 4 years later) you can also launch any of the Run or Debug configurations available in your workspace from... the Quick Access menu (Ctrl+3 shortcut)
Note: For performance reasons, the extra Quick Access entries are only visible if the org.eclipse.debug.ui bundle was already activated by some previous action in the workbench such as editing a launch configuration, or expanding the Run As... menus.

Eclipse Run As Groovy Script by Default

I'd like to run my Groovy project in Eclipse using a shortcut (CTRL+F11). The trouble is, every time I do so I get a "Select a way to run " dialog, which gives me the choice between Groovy Console, Groovy Script, Java Application.
I've already set a Run Configuration to use Groovy Script, and if I click that Run Configuration under the Run As menu, it just runs.
How can I get my project to execute from a keyboard shortcut without that dialog popping up? I can't imagine ever selecting one of the other options.
I've never been able to get a satisfactory keyboard shortcut for Groovy script runs out of ctrl-F11. Instead I use alt-shift-X and then press G when the menu appears.
For debugging I use alt-shift-D, then G.
Both are two-stroke, rather than one-stroke, solutions, but neither one forces me to use the mouse or the arrow keys.
Under Project>Properties>Java Build Path and then click on Java SE, what ever it may be, click finish.
On the off chance that you deleted your java system library you can o pick up a new one... http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

See Eclipse Run Configurations in a View

I have a lot of Eclipse run configurations that I frequently access during my daily work (things like doing a maven clean build for various projects, running a test gui, deploying apps etc etc). The Run Configurations Window (accessed via Run->Run Configurations) is reasonably good and supplies me with most of my needs, but:
I hate having to manually open it up every time I need to run something.
The window is modal and that I can't easily access other Eclipse features while editing a configuration.
It loses any filters that I have applied previously.
Is there a way to have this window fixed in a view that I can access at any time, and that it maintains my context? It really seems to me that this feature was designed with little regard for the "Eclipse way of doing things".
I know about setting configurations up as "favourites", but I have probably close to a hundred of these configurations, and the favourites menu is simply not designed for that amount.

How I can organize run configuration in Eclipse?

In Eclipse, I have organize my favorite "run configurations" but I have a lot of favorite.
So I would like to know if a plugin exists that permit to create folders or sub-lists to have a better view and organization of my run configurations.
I would like this because when I click on the "arrow" near "Run" button on the top of the Eclipse toolbar I have a very long list and it's diffuclt to find quickly the "run configuration" that I want.
I hope somebody have an idea and can help me.
Thanks.
Sincerely,
Arnaud
There are some ways to help a little bit:
If you are more interested in the last started run configurations, these get a number. Number 1 is the last, number 2 the previous before and so on.
Press ALT-SHIFT-X followed by the type of run configuration (j for Java), and you get a list of run configurations. Type in the filter box, and select by cursor keys.
Under Run > Organize Favorites ... you have the option to mark some of them as the ones you want to use often. These will listed at the top of the selection list then.
Run configurations... > Filtering Preferences... will open the preferences where you are able to define which filter should be used for the run configurations. If you use Working Sets in your programming, this could be helpful, so by switching Working Set, the run configurations come with it.
I think the keyboard shortcut is the fastest one if you want to use the run configurations all. If there is a special order, the first tip by be sufficient. If your context changes, and the run configurations should change as well, use the working sets.
I'm a bit late, however it might help future readers.
Well, if you want to manage your Run Configurations I would recommend you Eclipse Runner plugin.
I hope that helps.
I don't know of any plugin that does that, but in Eclipse the chosen run configuration if you hit the run button is the last one ran. Which is what you'll need most of the time, typically. Otherwise you can just go inside the menu, where all configurations are grouped by type and choose from there, that might take a couple more seconds but maybe is not so confusing.
One way to do it is to save the run configurations as "Stored Files" in various project directories. This doesn't require saving or loading manually, you just select "Shared file" in the "Common" tab and set it to a project directory.
When you open or close one of these "Projects" (even if that project contains nothing but run configurations) it will show/hide those configurations.
I'm currently considering creating some "Fake" projects just to hold launcher groups.

Speeding up PDE edit-compile-debug cycle

Are there any low-hanging fruit regarding some more efficient way to run and test Eclipse-plugins (within the PDE)? Besides slimming down the Eclipse-configuration, which has already been done.
I usually minimize my launch configuration itself (not sure if that is what you are doing). Here's how I do it:
Create a new launch configuration
Go to the "Plug-ins" tab
Select "Launch With:" -> "Plug-ins selected below only"
Click on "Deselect All"
Select only the plug-ins you are debugging from your workspace
Optional: You can uncheck "Include optional dependencies..."
Click on "Add Required Plug-ins"
Save the configuration and launch
Now, this might not work in the first shot. This probably means you have an issue with the defined dependencies. This is also a good test for that as well. Fix it, relaunch, and it should run much smoother.
I use Launch As: Eclipse Application and I don't find it to be too bad. I've found that changing the plugin.xml (or fragment.xml) always requires you to quit and respawn to pick up the changes, but changing Java doesn't always as the changes can often be hot-swapped in. (PDE is good at warning you when it can't.)
I'd like it if Eclipse could dynamically insert my plug-ins into the running environment -- it can do this with regular plug-ins. As for speeding up the edit-compile-debug cycle, I normally prototype my work in small SWT / Swing applications before integrating them into the full product, but this might not work in a lot of cases.