olafure
olafure

Reputation: 3617

Make Eclipse NOT run project on errors

Is it possible to make Eclipse (Helios SR2) NOT run your project on errors, instead of prompting for an answer or run anyway ?

Scenario:

In eclipse, I hit the Run button. There are compilation errors. Eclipse asks me if I would still like to continue with the run. I have the options of "Yes" and "No". I can also tick "Always run without asking".

In Eclipse Preferences, under Run/Debug > Launching there are radio buttons for "Continue launch if project contains errors", but they only give 2 options, "Always" or "Prompt". Other sections on that page give the options "Never", but not this one.

Now. I'd just like to never run if there are errors, without any prompt (a console message would be just perfect, but not required). Is that possible ?

Upvotes: 18

Views: 5981

Answers (5)

Wiley
Wiley

Reputation: 526

Use the Build button instead of the Run/Debug button.

Upvotes: 1

Zayat
Zayat

Reputation: 39

Preferences > Run/Debug > Launching > Continue launch if project contains errors > Prompt Voila!

Upvotes: 2

Engztrom
Engztrom

Reputation: 91

IMHO this seems like a very dangerous and error promoting behaviour (especially the "always run without asking" selection!)

If there are compiler errors, then I want the run attempt aborted so I can fix them, and if the code runs, then I want to be able to rely on it to (at least) be free from compiler errors... Why on earth would I want to risk running code that contains compiler errors, and spend hours debugging weird behaviours in the execution, when the root of the problem is already known?

Wouldn't it be more natural to have "never" as default, and "promp" as an option?

Upvotes: 9

Nivas
Nivas

Reputation: 18364

No. This is not possible.

But why would you want that? IMHO the prompt was the best eclipse (or any other s/w for that matter) can do. If you hit run, then you hit run, and you want the file to run.

Is there any specific reason why you would want to hit the run button and the want the project not to run? It is very highly possible that you think you did not hit the run button and hot it again wondering what happened, rather than expecting that the project has errors.

Upvotes: 1

Tonny Madsen
Tonny Madsen

Reputation: 12718

The short answer is no. This is not possible today. The idea is that you often want to run the code even if there are errors in the code. The Eclipse Java Compiler can actually compile most classes, even if they contain errors...

Upvotes: 0

Related Questions