Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create default debug and run configuration in Eclipse?

Tags:

eclipse

Whenever I hit Debug or Run in Eclipse, I get a dialog asking me what configuration I want to use.

How do I set a default configuration and bind a keyboard shortcut?

like image 856
Nikola Smiljanić Avatar asked Jan 16 '10 19:01

Nikola Smiljanić


People also ask

How do I change the default debug in Eclipse?

Window | Preferences... Choose Run/Debug on the left, about half-way down. Choose Perspectives under that. Select Never at Open the associated perspective when launching and Open the associated perspective when an application suspends.

How do you debug and run in Eclipse?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.


1 Answers

Maybe this article from Eclipse One Tips will help you:

How to run the last launched application

The answer lies in a preference hidden on the Run/Debug page:

  • Go to Window > Preferences > Run/Debug > Launching.
  • Select the option Always launch the previously launched application. It’s located at the bottom of the dialog.

The preference should look something like this:

Launch previously launched prefrences Now you’re free to press F11, Ctrl+F11 or click the Run/Debug icons on the toolbar with confidence, knowing it’s going to run what you expect it to run.

One question arises: How do you quickly run a class as a specific application (eg. a JUnit test) if you can’t press F11 to run it? You have some options available:

  • The fastest way is to use keyboard shortcuts. Eclipse allows you to launch classes using a keystroke, including JUnit tests, Java applications, etc using Alt+Shift+X.
  • Alternatively, right-click on the class and select Run As. The submenu will show available options for launching the class.
  • Lastly, you could click the pulldown arrow on the run/debug icons in the toolbar and select Run As. The submenu once again shows available options for launching the class.
like image 126
nanda Avatar answered Sep 24 '22 06:09

nanda