Is there any difference between "Run Configurations..." and "Debug Configurations..." - eclipse

In Eclipse (Mars, probably older versions too), the Run menu has Run Configurations... and Debug Configurations..., both of which open the same dialog window. The only functional difference I've found so far is that one has a "Run" button, and the other has a "Debug" button.
It looks like both dialog windows can be used to edit Launch Configurations, but it's not clear if there are two separate configurations for Run vs Debug, or if they are the same.
Is there any substantial difference between the two dialog windows, other than the button next to the "Close" button?
Bonus question: Is there another way to view and edit Launch Configurations besides the two menu options I mentioned (and their equivalents in various toolbars)?

There is only one configuration which is shown in both the Run and Debug Configuration dialogs.
The configuration is actually stored in the workspace .metadata in the .plugins/org.eclipse.debug.core/.launches folder. There is one xxx.launch file for each configuration.

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.

Is it possible to set which file to run by default in eclipse?

I'm writing a python project in Eclipse with the PyDev plug-in, which contains multiple files.
However I'm used to using visual studio, where it'll automatically find the main function of a project and run the program from there.
Eclipse will always run the file I am currently editing (which usually is a file containing function that are called from the main function).
Is it possible to set which file should be run then clicking run? I've looked at the launch options under Project->Properties->PyDev, but didn't find what I was looking for.
When you press the Debug or Run button (Debug on the left) Eclipse tries to intelligently determine what to launch based on your current editor.
You can change the behaviour by editing Window -> Preferences -> Run/Debug -> Launching -> Launch Operation as pictured below.
The default of launching the current editor works well for some languages, but not as well for Python when every single file is itself a valid program to run. In your case I recommend changing to Always launch the previously launched application.
You can create a custom run configuration.
Right click on your project > run as > run configurations
From here is just a matter of choosing your project type on the left hand side and filling in the required information. You can click 'Run' to use your new configuration.
To get to this configuration again, you can click the 'Run' drop down button in the eclipse tool bar and see all of your run configurations.
Hope this helps!

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 can I get MoreUnit to debug tests rather than run them?

I've just started using MoreUnit and it seems quite handy. One thing that I am missing however is how to run tests using the debugger right away rather than just plain Run (using ^R).
It's not in the context menu and I have tried a few keyboard shortcut variations to no avail...
Usually in Eclipse, you can just click on the debug button after running the tests normally to debug them (the last run will have created a launch configuration that you can also access from the debug menus).
Other than that, you should find a "Run as MoreUnit test..." in both the "Run" and "Debug" menus (if not, file a feature request).
Lastly, you should be able to open the "Launch Configuration" wizard by selecting "Debug..." and there should be a folder for MoreUnit in the tree on the left. Above the tree is a "+" option to create entries in a folder.

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.