Ugnius Malūkas
Ugnius Malūkas

Reputation: 2837

Intellij doesn't show run button

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.

Upvotes: 36

Views: 95097

Answers (12)

Altaha
Altaha

Reputation: 21

I face similar issue. Later i found out that it's happened because i install a plugin called ZK (Zul Framework). After i disable that plugin, the button reappear and everything works fine.

You can try to disable some plugin on your intellij by click file > settings > plugins > installed > choose a plugin that you consider make this issue > disable > apply > ok > restart your intellij.

open settings

disable plugin

Upvotes: 0

Sukh
Sukh

Reputation: 540

In my case there was a plugin (springboot helper) which I had to disable.

Upvotes: 0

amer
amer

Reputation: 1682

IDE: Idea 2021.2.3

Build tool: Gradle

I removed the .idea and reimported the project from the Gradle source. Worked fine after.

Upvotes: 3

Slycreator
Slycreator

Reputation: 1230

I had this issue when building a microservice with SpringBoot. I added a new microservice into the root folder and I could not run it.I am using Maven.

Step:

  • Open pom.xml
  • right click and select "Add as maven project" It should resolve it immediately but you can reload the IDE if it does not update immediately.

Upvotes: 3

VitalyR
VitalyR

Reputation: 11

First, make the folder as source root.

Second, make sure you set the project’s sdk correctly. For example, if you set the sdk correctly then import java.util.Scanner can be analyzed by IDEA.

Tip:

  1. try not setting the SDK to IDEA’s bundled JDK. I set the project’s SDK to JDK 11 bundled by IDEA at first then found it couldn’t resolve import java.util.Scanner. Setting to JDK 16 which is installed by the OS’s package manager solved this problem, then the “run” button showed up.

  2. If IDEA can index a java file then the file icon will show with a small “c”, indicating a java class. If not, the file icon will show with a small “j”, as this problem’s image shows, indicating a java file which IDEA doesn’t index.

Upvotes: 0

Kai Wang
Kai Wang

Reputation: 1

Reinstall the IDE, it solved my problem.

Upvotes: -2

anonymous123
anonymous123

Reputation: 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.

Upvotes: -2

daparic
daparic

Reputation: 4484

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.

Upvotes: 9

lainatnavi
lainatnavi

Reputation: 1613

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

Upvotes: 0

Tkim
Tkim

Reputation: 360

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

Upvotes: 4

Zmiter
Zmiter

Reputation: 328

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

Upvotes: 6

gevorg
gevorg

Reputation: 5065

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

Upvotes: 104

Related Questions