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.
Related
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.
I think it might have something to do with asynchronous tasks but I don't know for sure. Could someone please clarify this for me?
Also what do the yellow frames mean when you are debugging?
If this suddenly happens to your project:
Consider closing pycharm and deleting the .idea/ folder of that project.
After reopening the project the project, pycharm will detect all files as normal.
But you'll need to set up the project again.
-> Set source-folder, add run configuration etc.
For me that was the faster solution than figuring out how to fix it.
One more mention: It happened after a merge which caused some version conflicts and required to "roll back" a file.
This also happened to me and the cause was that the project folder was removed from the 'project structure'. You can re-add it in Settings-> Project <...> -> Project Structure.
See also the documentation: https://www.jetbrains.com/help/pycharm/configuring-project-structure.html
The above solution did not work for me -- by happenstance, I was clicking around the settings in Intellij/GoLand and stumbled across a solution that worked for me.
When I went to the Project Structure, the Project Structure pane was empty and there was no way for me to manually re-add my project directory.
Fix that worked for me:
Top Menu Bars -> File -> Repair IDE
A bubble window shows up on the bottom right, and I just clicked through the tooltips to repair different aspects of Intellij. In my case, the 'Reindex Project Structure" step worked for me (it was Step 3 of 6 in the repair process).
After repairing + waiting a bit for the project to reindex, everything went back to normal.
This color indicates the non-project files (libraries), you can customize it here:
Make sure to restart the debugger for the changes to have effect.
As #Framester points out, the project source is missing from the IDE config.
Right clicking on project root you can add that as a Source
Select:
Mark Directory As -> Sources Root
I know this question has been asked before and I have seen a plethora of solutions out there, yet none seem to work for me. I was able to build my apk without issues until this error started cropping up. I have tried cleaning my project, removing it from the workspace and reimporting it, removing "Java Builder" from my Builders for the project, building the project manually, reordering my java build path. I have no visible compiler issues and no problems exist in my workspace.
I did experience this issue before and solved it once by removing the project form my workspace and re-importing it and another time I solved it by removing "Java Builder" from my java build path. None seem to work this time. I currently have most of the settings set back to default (i.e. java build is checked again).
I am running windows 7 (64 bit) and using jdk1.6.0_21 via Eclipse 3.6.
Any suggestions would be greatly appreciated as I have lost loads of development time troubleshooting this already.
[Update] My locale is English & I have tried removing the debug.keystore, United States as related to issue 834
Please follow these steps; this might help you out:
Right-click your app project and go to Properties
Select Android from left-hand side list
Uncheck the "Is Library" checkbox
If your app project relies on library projects which are in your workspace, those of course need to have the "Is Library" box checked.
deleting the R.Java file in /Gen folder did the trick for me
I tried all the above solutions. but it didn't work.
The solution was to restart eclipse !!!!!!!
hope this will help someone :)
In my case this problem started after eclipse updated the plugin with the v4.0 API release. I fixed it by going to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
Note: if you eclipse gives you the Unknown Command 'crunch' error then follow this post
I've tried to gather the best of other peoples answers into a step by step list of things to try in order:
Check the project is not set as a library:
Go to Project->Properties
Select Android from left-hand side list
Uncheck the "Is Library" checkbox
Clean and rebuild the project - this should delete and recreate the entire gen folder, including the R.java file mentioned in some peoples answers
Check eclipse and all the Android plugins are up to date
Close the project, exit Eclipse, reopen eclipse, reopen the project.
Go to Java Build Path > Projects and check for any incorrect project dependencies
Go to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
Check JAVA_HOME is set correctly. Follow the steps in this article
If you complete the above list, and still haven't solved the issue, please leave a comment, or if you find something else that works, feel free to edit the answer and add your thing in.
Delete the project from your workspace & import again.
This worked for me.
Can't believe similar issue has been there since 2008.
http://code.google.com/p/android/issues/detail?id=834.
i'm no expert, but eclipse on Windows, doing android apps, refuses to create the default.properties file (in the app root directory). I've just copied one from another app and it works fine. Simple contents, for Android 2.2 project it just says (ignoring comments):
target=android-8
fwiw
I was having the same issue as the OP except that all these suggestions did not work. I found a solution for me.
Make sure that "Skip packaging and dexing until export or launch." is selected.
Go to Window -> Preferences -> Android -> Build. Just make sure that option is selected and apply.
I know this does not make a lot of sense, but having it unselected was giving me this error and with it selected it goes away and the apk is installed.
I am using the auto generated ant build script from android and ONLY using it as my build process in eclipse. I am not using any other build methods.
I figured it out. I was referencing JavaSE-1.5 and using JDK 1.6. I changed it to use 1.6 and that appears to fix it.
Seems like through my research that is an overloaded error message that covers a lot of error cases.
I just fixed this by reselecting a default JRE for the execution environment (JRE6 for JavaSE-1.6 in my case). It got unchecked for some reason.
This fixed my problem. I kept getting the console error in eclipse "Could not find com_android_vending_licensing.apk" and even though it didnt seem to effect the way my app ran, it was annoying. So going into the com_android_vending_licensing project properties and unchecking the "is library" option, building the project to produce the needed apk and then going back into the com_android_vending_licensing project properties and re checking the "is library" check box fixed the problem.
Run Eclipse as "Administrator" and then import the project.
None of these things worked for me. I'm trying to access native code through the jni, first with NDK samples. What I found was the build won't run if jarlist.cache is not present in the project bin directory. If I copy one from another project to that location (may need to refresh to see the folder in Eclipse), build works every time.
Clean the project and it will do. Sometimes it happens unknowingly but keep trying to solve using diff methods.
I had somehow done a Run configuration as a Java application instead of a Android.
the problem for me was I was trying to use IBM RAD which appears to not work properly for this, I installed Eclipse and now have a different error but I should be able to get past it
On my machine (Windows7, 64bit) I could fix this by setting my execution environment to a 32bit variant of the jdk (I used 1.6.0_23). And I tried a lot of things before...
SHA1's answer did it for me: after updating to the latest sdk/adt, my project refused to build an apk; unchecking the option resolved the issue.
I don't know if the update checked this, or if it was checked before but the new adt screwed things up, but things work again now :)
In my case this worked :
Delete R.Java file in /Gen folder
+
Delete all "R.Android" imports that Eclipse added to some of my java classes !!!
and rebuild the project.
remove -- R.java -- Clean the project and run again.. this worked for me ..
Find the project's folder in your system, enter it's Properties via context menu and deselect "Read only" option. Worked in my case.
This seems to be the source of the problem in many cases, moreover some solutions up there base on copying/rewriting the files in the project what makes them non-read-only.
This is caused by JAVA_HOME not being set correctly. It can be easily resolved by following the steps in this article.
Mine was caused by this problem (incompatibility between ADT and SDK), and was fixed thus:
Eclipse > Help
Install New Software
Add 'https://dl-ssl.google.com/android/eclipse/' to 'Work With'
section and press enter
After developer tools appears on the list, check it and click Next
Restart eclipse once download is finished
I my case, I had to switch from API 21 to API 19, clean and build and everything was fine again. I am using a Mac and apparently API 21 is not fully supported on Yosemite.
I usually run a dual-monitor setup, so I have two Eclipse windows open for the same workspace, displaying different files. When I'm debugging and a breakpoint is hit, Eclipse switches to the "Debug" perspective, but it also shows the file/line where the breakpoint is in both of my windows. This occurs even if the file containing the breakpoint was open in one window but not the other (before the breakpoint was hit).
This is really annoying.
How can I have Eclipse only show the file containing the breakpoint in one window? Ideally, it would choose which window based on where the file is open already. If it's not already open somewhere, I don't really care which window it pops up in.
You can create another workspace and in that workspace create a new project from the same src code (same files in file system) of the one in your current project in your current workspace.
That would let you stop on one breakpoint without the other window stopping their too.
Notice that after you make some code modifications in one project you'd have to refresh the other project for those changes to apply in it.
Eclipse switches to the debug perspective for all windows the debug perspective has been opened once (i.e. the little icon on the right top corner is available). If you close that perspective (switch to another perspective is not sufficient), it won't switch to it anymore on that window.
At least, that's the behaviour I observed on Kepler (I know, that question is older but just came across, maybe it still helps someone).
This worked for me:
In Window->Preferences->Run/Debug->Launching->Launch Configurations enable "Apply window working set(s)"
Personally I find this more efficient than creating two workspaces.
Closing the Debug perspective (righ-click on the little icon on the right top corner) worked for me.
I'm using Oxygen and I have the following settings in the Run/Debug Preferences:
Open the associated perspective when launching: Never
Open the associated perspective when an application suspends: Prompt
Maybe you select the sources for Debugging by "File System Directory" instead of by "Java Project". To change this go to Run=>Debug Configuration=>Add Sources=Button: ADD...=>Java Project and select your Projects.
Make sure, that the added sources are found first by moving them to the top.
To disable multiple debugging in multiple windows in eclipse, go to Windows > Preferences > Run/Debug and uncheck Activate the debug view when a breakpoint is hit
I have recently been setting up SVN in Eclipse using the Subversive plugin (I am still a bit lost, but that's another issue).
I have been using this guide (http://soledadpenades.com/2008/12/10/add-svn-support-to-your-eclipse-installation/) and finally got it working!
The only problem now is, I can't seem to find the Package Explorer, which is the only explorer I could ever seem to get working how I wanted it to (grouping projects into working sets).
Normally, you get it from going to Window → Show View → Other, and then select it from the list. The only thing is, it's not IN the list of views... leaving me rather confused.
Just to be clear, I was using the package explorer before with no problems. I am running the latest version of everything as I did the auto update.
Any suggestions as to what is wrong here?
I'm guessing you've made it a fast view or minimised it to it. You could try holding down Ctrl + F7 to see a list of all views, then up/down arrow to the View. If Package Explorer is in the list it has been minimised or something.
If you select it and still can't see it, try Window → Reset Perspective... to restore all views to their defaults.
Alt+Shift+Q worked for me when I was in debug mode.
Weirdly enough, although reset perspective didn't work, menu Window → New window worked! It opened a new window with the perspectives reset.
For me I needed to do two things:
Reinstall the "Eclipse Java development tools" via Help → Install Software → Programming Languages
Delete and recreate the .metadata Eclipse Workspace settings.
Honestly, deleting the .metadata directory is probably sufficient - try that first.
At the top right corner, there is a button called Open Perspective. Click on it, and then Java Default. Everything will come back to normal.
Are you sure you are in the Java perspective?
As views are related to perspectives this could be the problem. The current perspective can be found in the upper right corner.
You may be missing the JDT plugin containing the Package Explorer.
I think you were actually still in the Debug perspective, since that was what did it for me. As someone mentioned above, I had to go to the top right and hit "Java perspective" to get back to my normal views.
Three answerers were helpful, however the only cure was to reinstall Eclipse and install the plugins again. Weird problem, and the exact cause not found. I may have deleted some files somehow, but a reinstall solved it.
On the right top you can select Java or JRE or whatever. That button might got changed. So click the neighbor buttons such as Java or something.
Go to Window -> perspective -> Open Perspective -> Java. Now all the packages in Java will be displayed in the package explorer.