user5958101
user5958101

Reputation:

How to stop running other classes in Intellij

Lets say that you have created lots of java classes and some of them had error

say you have created today another java class file and you want to run that file but then you get another warning from another class.. Do you know how to "mute" other classes? I cant just go every classes and put // every row..

Im using Intellj.

Upvotes: 1

Views: 1864

Answers (3)

GhostCat
GhostCat

Reputation: 140407

Quick answer: don't do that:

  • do not put different java classes into the same project that don't "belong" together
  • do not keep source code around that doesn't compile

The point is: programming is as much about "craftsmanship" as it is about "art". And do you know what makes up a good craftsman? It starts with: he keeps his stuff in order. He doesn't leave things lying around to get lost or to stumble upon. It is the very same thing when programming. Anything in your setup that distracts you from solving your current problem needs to go away - but in a clean manner; not by sweeping dirt under the next carpet.

And even when you are just beginning to learn: try to keep things in order. Actually: you better learn from day one to not ignore compiler warnings or errors. Because: sooner or later, you will waste noteworthy amounts of time ... because something in your project is in a bad state; but you are overlooking that; because you trained your brain to ignore warnings and errors.

It is much better to accustom yourself right from the beginning to a zero tolerance policy: you allow for zero warnings, zero errors, zero "fixme/todo" comments in your source code.

Upvotes: 2

Awais Ahmad
Awais Ahmad

Reputation: 427

simply cut those classes from your project directory and save them on your computer if you use them in future and then do whatever you want with your new class

Upvotes: 0

yole
yole

Reputation: 97123

You can right-click a compilation error message in the "Messages" toolwindow and select "Exclude from compilation" option in the context menu.

Alternatively, if your new class does not need to reference any of the other classes, you can create a new project or a new module and put the new class there.

Upvotes: 1

Related Questions