Why can't I run particular classes in Intellij? For instance, I have following classes in the same project, but I can't run all of them. How to fix that?
Asked
Active
Viewed 649 times
0
-
2Do they have a main method? If not, how could they be run? – JB Nizet Dec 10 '18 at 19:28
-
Afaik, the ones with the triangles have a runnable `main`. If they don't have a triangle, they must either not have a main, or the signature for the `main` is incorrect. We can't say without seeing them. – Carcigenicate Dec 10 '18 at 19:28
2 Answers
2
These classes have methods with the signature public static void main(String[])
, the entry point for a Java program. Classes that don't have a method with this signature will (with some exceptions, i.e. JavaFX' Application
) not be shown as runnable by IntelliJ.

Marv
- 3,517
- 2
- 22
- 47
2
According to the documentation it denotes a:
Java class that contains declaration of the main() method.
If you want to run the program you will need to add a main()

GBlodgett
- 12,704
- 4
- 31
- 45