18

Intellij doesn't show run button even if that file is in src folder.

no run button

Maybe do you know what to do?

P. s. It's strange because that file used to show run button but after recloning git repository it just doesn't show any more.

Ugnius Malūkas
  • 2,151
  • 6
  • 26
  • 37

6 Answers6

51

Right click on src directory and select option Mark Directory As > Sources Root.

gevorg
  • 4,273
  • 4
  • 32
  • 49
4

In my case Run/Debug buttons disappeared for all projects after updating from IDEA 2019.2 to 2019.3. Tried checking Sources Root, Invalidate Caches, Run/Debug configurations etc - no luck. Only restoring Run/Debug action group helped:

Right click on main toolbar (where the button disappeared) > Customize Menus and Toolbars... > select Run/Debug > Restore Run/Debug.

enter image description here

Zmiter
  • 298
  • 3
  • 15
  • 1
    This didn't work for me however it helped me get to a solution that did work for me. In the same menu as the picture above 1 Click main toolbar then toolbar run actions. 2 At the "Toolbar Run Actions" leve, click the + button and "add action". 3 In the new popup, choose the "main menu" folder then the "run" folder. 4 Click on the "Run" icon and click ok. For me it added all the missing button (run, debug, debug with coverage etc). If Some button are still missing, use the same way to add other buttons. – Vilcoyote Dec 17 '19 at 09:53
  • Seems to be fixed in IDEA 2019.3.2 https://blog.jetbrains.com/idea/2020/01/intellij-idea-2019-3-2-is-out – Zmiter Jan 22 '20 at 17:35
3

There is an Intellij bug that will result to an intermittent disappearance of that little tiny green run button on the left side of the source code (on same column where the red circle breakpoints are). Yes, you can right-click on the mouse and can do the run via the menu, BUT we love that tiny green button so bring it back!! From time to time, i see this green friend and then suddenly it vanish mysteriously and comes back again. I did all, such as rm -rf .idea and other weird stuff, but no explanation has ever been achieved to explain the vanishing green button and it's sudden re-appearance intermittently.

I am drafting this answer, because all of the above answers seems to claim that there is a logical explanation of the intermittent disappearance of our little green friend and that a sequence of steps exists to make our little green friend re-appear, when in fact, there is no such steps and we just have to accept this is a bug to save the remaining hairs in our scalp.

eigenfield
  • 2,331
  • 1
  • 22
  • 23
1

I got the same problem with intellij 2019.3 and 2020.1 and found the solution here : https://youtrack.jetbrains.com/issue/IDEA-228180.

Basically, in the IDE the buttons run/debug and the error detection in the code were missing.

The fix was to disable the plugin 'Gradle' (I don't need it anyway) : Settings > Plugins > Gradle and click disable and apply. After restarting your IDE it should work

Tkim
  • 172
  • 6
0

Another reason could be the Highlighting Level set to None, it should be set at least to Syntax.

lainatnavi
  • 953
  • 1
  • 6
  • 16
-1

I also applied all these methods but it still didn't work so I stopped my window firewall and allowed access for this application. I don't know how it worked out for me but it just got displayed on top of my screen that window defender firewall has stopped some of this app's features and there was an option to allow so I clicked on it and it now works just fine.

double-beep
  • 3,889
  • 12
  • 24
  • 35