Run button is greyed out - intellij - java

I was working on a project in Intellij then suddenly there was a pop up and now the run button is greyed out. It is a Java FX project and it runs with coverage and debug, but the normal run button is greyed out. What could be the problem?
PS: I know I don't give you much to work with but unfortunately it was working and now it isn't, that's all.

I had the same issue and fixed it with the old "Invalidate Caches and Restart"

Open the source code, right-click and hit run using the option run "filename.java".
IntelliJ will make the configuration for you and then you can click the run button after the configuration is made by the IDE.
Same thing for debug configuration.

This has happened to me countless times. One possible problem is that the program is still running in the background and hasn't exited completely. Check your running processes for java applications and see if it exists.

Try to start the program again via Run in the menu bar.

Alt+Shift+F10 solved my problem.
I guess for me disabling windows instant replay fixed the issue.

Restarting IntelliJ and re-opening the project resolved the issue for me.

I think it the maven/gradle plugin that failed to load.
For me I closed the project, open another previous project and the run button appeared.Then I closed it and open my new project,I got a prompt bottom right that says "load maven script" I clicked it and it was resolved.

Change the jdk version to 11 or any lts ..
Steps :
file> Project Structure
Edit SDK [enter image description here][1]
Click on the below link to see the image for editing SDK :
[1]: https://i.stack.imgur.com/3IyXA.jpg

I had the exact same thing using IDEA 2021.3.3 ultimate edition. My "Run Hello (Shift+F10)" button was greyed out, so I right clicked the source code (any whitespace in the editor worked fine), and there was an option in the menu called "Run Hello.main() (Ctrl+Shift+F10)", which WAS clickable. I clicked it, then it ran, after which the first button was no longer greyed out.

Related

Intellij doesn't show run button

Intellij doesn't show run button even if that file is in src folder.
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.
Right click on src directory and select option Mark Directory As > Sources Root.
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.
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.
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
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.
IDE: Idea 2021.2.3
Build tool: Gradle
I removed the .idea and reimported the project from the Gradle source. Worked fine after.
Another reason could be the Highlighting Level set to None, it should be set at least to Syntax.
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:
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.
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.
In my case there was a plugin (springboot helper) which I had to disable.
Reinstall the IDE, it solved my problem.
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.

An error opening a new project in Eclipse

I've downloaded the JDK and Eclipse and started learning how to code in Java.
All of a sudden when I try to open a new project, I get this screen saying "select a wizard" with nothing to select. It won't let me continue.
I uninstalled and re-installed the software (although it worked fine before) but the problem remained.
What can I do?
I may be wrong but ... I'd say it is just a problem of the window size. Try resizing the "New Project" dialog to show its actual content :-)
Use another perspective, for example Java, JAVA EE
go to in menu Window -> Show View -> Other and select the perspective you like
Or access menu File New Project and select one time of the project
You have downloaded a wrong version of Eclipse. You can find the right one here
https://www.eclipse.org/downloads/

Netbeans stuck at startup

I was working with a big project on Netbeans.
I attached some source code on third party library and all went smooth.
Today I have the following popup message (I already had seen before obviously):
The file [...] cannot be safely opened with encoding windows-1252. Do you want to continue opening it?
The two buttons, yes and no, are not responsive. If I close the popup with the red cross it does nothing after a 1 sec loading.
Is there a way to "clean" the open file in the netbeans workspace to avoid this error?
SO Windows 8.1, Netbeans 8.0.2
Thanks.
One general solution to this kind of problem can be to clear the netbeans cache.
Quit NetBeans and find the cache folder - mine is at C:\Users\OldCurmudgeon\AppData\Local\NetBeans\Cache. Delete the whole folder - this can take a while as there can be a lot of files in there.
Netbeans will create a new one on next start.
Note that this will slow down netbeans for a while but it won't be long before it is back up to speed again.
Quit NetBeans.
go to the last Project folder then remove the project from the folder.
Open NetBeans.
I had a similar situation which started happening after I added a new project yesterday. I deleted the cache as someone recommended, but was still having the same issue. The solution was to rename the new project so it wouldn't be found. Everything worked splendidly after that.

Eclipse cut/copy/paste not working

I have installed the CodePro AnalytiX 3.7 plugin in my Eclipse Juno.
From then in any of the Java TestCase classes the keyboard shortcuts of the cut/copy/paste are not working.
Also the delete is not happening when I press the "delete" button on the keyboard.
The same works fine if I right click and select the operation from the menu.
In normal Java classes it works fine.
Please help.
I have faced the same problem, as #Pragnani said the reason behind this is because of notepad. my notepad becomes not responding that's why copy paste not worked for me....when I restart my system. every thing goes well..

Non-existing MySql message error

I have to build a Decision Support System, but dont have much experience in Java. So after I connected to MySql with Eclipse (with Connector/J) eclipse started to mess up my other projects. Now, when i try to run other projects in eclipse (that are not related to MySql, ex. Guessing Game) the following error message apperars:
Launch configuration DocsConnectionPropsHelper references non-existing project MySql connection test.
Can anyone help me to resolve this problem please?
UPDATE. it seems that when i press "RUN" elcipse is not running the project that im working with, but other
Your update indicates the issue is actually running the wrong project. To avoid that you may want to close projects you're not working on (right click them in package explorer and select close).
If you do need multiple projects open then when clicking the run icon (which defaults to re-run whatever was ran last among your open projects) make sure you have open in the editor window something that can be ran (and is from the project you want to run).
Then click the drop down arrow to the right of the icon. This will open up a small menu with options to change your build configurations or how it should run your program (i.e. as an application or on a server).
To solve the problem:
-click right botton on the project package you want to work on (run)
-choose Run As
-choose Run Configurations...
-choose DocsConnectionPropsHelper - if in the Project box you see not correct title just remove it. Also remove anything what is in the Main Class box.
-click Apply
-the best option is to close Eclipse and reopen it to make sure that all the settings were configured
It worked for me. Hopefully it will work for you too.

Categories