Why does Eclipse keep creating a new Run Configuration? - eclipse

I am writing some scripts in Eclipse 2.7 RC4, using the latest Groovy Eclipse plugin.
Everything works fine except that I have a Run Configuration that I created that passes 2 arguments to the script but every time I click the Play button to run the project, Eclipse creates a new Groovy Script Run Configuration called "Server (1)". If I click the Play button again, Eclipse creates another Run Configuration called "Server (2)", etc.
So, every single time I want to run my project, I have to go in and delete the last run configuration it made.
Why does Eclipse do this? Can't I lock the configuration so that it wont change?

I realize this question is quite old but it's still an issue that happens (as it was happening to me today) I played around with it a little and found that in the 'Run Configurations' window where you can set Arguments/Classpath variables etc there is also a tab named Common. I found that within this there is an option called "Save as" and if the 'Shared File:' option is selected (pointing to the exported launch configuration) it will keep creating new Run Configs every time you run it. If you instead select the Local File option and Apply the changes, I believe you will stop seeing new run configs saved each time. This worked for me, at least!

This is probably a bug in Groovy-Eclipse in that it is not recognizing that an existing launch configuration is the "same" as a new one.
Can you get around this by simply re-using the old on explicitly, ie- by clicking on the little arrow to the right of the run button and choosing the old configuration:

I am seeing the same thing for Java and Scala test programs I created in Juno version of Eclipse (latest as of Nov 2012). Very irritating to have to delete all those run configurations explicitly.

Related

Clicking run configurations not working for the java file I click on is my eclipse bugged or is this a simple fix?

Every time I right click on a java file to use the run configuration it won't open for that specific file I'm clicking on but the one I previously did. It will do the same for the button on the menu bar at top. I also noticed that it will only allow me to right click and use run configuration on the one I want only until after I run the program and get a run time error. I've tried to restart eclipse but it does the same thing still. So is this a bug on eclipses part or is it a preference option that can be changed?
Currently using Eclipse IDE for Java Developers - 2021-06
This all depends on what object you are right-clicking on, and its characteristics. If Eclipse doesn't see a "main" method, it won't allow running it as a Java Application.
In any case, you've provided very little information here. For instance, we have no idea what "it won't open" means.

How do you configure Eclipse to automatically "run as Scala application"?

I made a Scala package and a Scala application in Eclipse, but every time I try to run it from Run > Run, Eclipse asks me:
Select a way to run 'example.scala':
- Java Application
- Scala Application
How can I get Eclipse to know that the project or application file should always run as Scala?
Click on the menu item named Window in your Eclipse window.
Select Preferences from the drop-down list.
Once the Preferences window has opened, use the menu at the left to navigate to Run/Debug, then Launching
Under Launch Operation, tick the check box with the following description: Always launch the previously launched application.
Afterwards, Eclipse should ask you only once and remember that choice.
#soc describes a workaround to the problem. At the moment there is no other/better way to make this to work. It needs to be fixed in future.
Luckily, this issue is partially fixed in the current nightly build of the Scala IDE. There is a fix for another problem, that disables the "Run As Java" Option: Disable JavaLaunchableTester on Scala files
It works not for all cases, for example if one right clicks on a package the known "Run As" Options are displayed. But for objects with a main method it works quite well if one uses the "Run As" Option of the Source file.

How to forbid creation run configuration in PyDev

Each time I press run button (or using shortcut for it), eclipse creates run configuration in some unpredictable way (looks like it uses currently selected file in PyDev Package Explorer, which is very strange). How to force eclipse to use only manually created run configurations and forbid to creating new one for the current project. I have 'Always launch the previously launched application' checked, but it doesn't help.

How can I clean up Eclipse "run configurations"

I set my java runtime options in Eclipse's Window > Prefs > Java > Installed JREs > Default VM Arguments. Since this setting is sufficient for all my main() entry points, I do not bother with customizing the "run configurations". It looks like nice flexibility but I probably will never need it. I was worried that I would have to repeat my VM arguments in the run configurations and so I started to copy my VM arguments but after an experiment it seems that I do not have to. Now I will have the opposite worry that I have some unintended customizations.
To eliminate the second worry, is there a way to eliminate the clutter visible in the Run drop down menu? What about the "Launch configurations" visible in the JAR export dialog? Is a run configuration the same thing as a launch configuration? How do I eliminate the multiple launch configurations?
I am on Eclipse Indigo on Ubuntu.
Edit After I manually delete all the run configurations, and proceed to do an export, buttons are greyed-out so I can't proceed. When I select the launch configuration drop-down, I end up with only one choice, from an unrelated project. I then created a run configuration for the real main entry point for the current project. I expect the clutter will return as I continue to use Eclipse.
One simple way would be to organize your projects by Eclipse workspace, which would limit the "run configurations" list only to the project referenced in a given workspace.
Switching workspaces would reset that list to the ones recorded for the projects of the new workspace.
Note: the OP's answer regarding launches file location isn't the only location possible.
The official one is:
${WORKSPACE}/.metadata/.plugins/org.eclipse.debug.core/.launches
But you can copy them enywhere else you want (as explained in "How do I save Eclipse launch profiles across workspaces?"), either by manually copying those files or by sharing them:
See "Which eclipse files belong under Version Control".
Once you know where they are saved, a simple delete is enough to make them disappear from the launcher menu.
The answer comes from #Francisco Puga
Experimental evidence shows that deleting "launches" seems to make run configurations disappear so it would seem that they might be synonymous.

Eclipse can't find project source after tomcat restart

I posted this on the eclipse forum in November and didn't get an answer. It seems that someone must have experienced this problem before, so I thought I'd post it here as well.
General Description: Every time I restart my local tomcat web server, the next time I hit a breakpoint, eclipse can't find the project source.
Background: I have been using Eclipse at my current job for about seven months. I did not encounter this problem for the first two months but it has been consistent for the last five months. I thought it might be related to a specific project, but it happens on every project I open, even projects that did not previously have the problem.
Details: Each and every time I restart my tomcat web server, then the next time I hit an eclipse breakpoint, the source window is empty with the message "Source not found." in red, and then below that the button: "Edit Source Lookup Path..."
I click on the button, which brings up the Edit Source Lookup Path window with only Default listed under the Source local Lookup Path section.
I click "Add..." which brings up the Add Source window. In that window, I double click on "Java Project" which brings up the Project Selection window. In that window, there is one project listed (the project which is currently open which I am currently debugging).
I check the checkbox next to that project and click OK (leaving the two other checkboxes checked). This takes me back to the Edit Source Lookup Path window and now my project is listed along with Default under the Source Lookup Path section.
I click OK and the source appears in the editor window and I can proceed without any problems until the next time I restart my tomcat server (which I might do ten or more times a day).
Other Info: I have tried modifying the project's Build Path Source section and adding the local code jar to the Build Path libraries, but nothing seems to fix this. I have done a lot of googling and have searched this forum and the bug list, but can't find any relevant information. As I said, this problem only started occurring out of the blue about five months ago and now it happens every single time. Is there an environment variable I need to set?
Any help is much appreciated!
Thanks,
Jeremy
Just to follow up, today I took the time to create a new workspace in eclipse and it fixed the problem. It wasn't an easy process because my environment has a lot of tricky settings that needed to be restored. But it's done now.
I accomplished creating a new workspace by simply renaming part of the path to my old projects. Once I did that and restarted eclipse with the -clean option, I had no projects and my old workspace settings were all gone. So, then I just created new projects from the existing code ...