Related
I've installed 30 day trial of IntelliJ 15.0.2 and cloned my project using git (I've created this project in community version). Project compiles (maven), runs, works. But new IntelliJ does not underline my errors, misspellings etc. When I wanted to commit, IntelliJ shows big number of errors, mostly on imports, as it can't resolve them. All dependencies are inside pom.xml. Once again, there were no errors in community version of IntelliJ. Ultimate version builds project just fine, but doesn't underline any errors and shows almost every import as unsolvable. What could go wrong? How to fix it?
Go to Build -> Make Project. After that errors should be visible in the project tree and in the specific project files.
You may need to mark the source dir, by right-clicking it on the project tab and select mark directory as -> source root
Check that you have a correct project sdk set in modules configuration. If IJ doesn't found any classes, jdk classes included, probably there is no sdk set.
You can also try to invalidate caches (in File menu) and rebuild project
I have faced with strange behaviour of Intelij Idea after update (syntax highlight stopped working). If you want to understand what is going on with yor Idea and can not quickly find an answer in internet, just go to Log files (for Mac OS the path is
~/Library/Logs/IntelliJIdea< your version>
List all files in that directory
ls -la
in terminal and find the latest one. Usually it should be idea.log (without numbers, logs with numbers identify logs for previous days). View that log. If that log contains a lot of ERRORS, try to find the reason (you can just type
grep "ERROR" idea.log
in terminal to find all lines that contain errors). Usually log files shouldn't contain errors, just info and warnings.
In my case syntax highlight stopped working. The log looked like
You can see here that error is in plugins that called like haxe.
I found that plugin in my idea, uninstalled it and idea started working properly. I investigated the log after and what I have seen there:
You can see just INFO in new rows.
Investigating a log can be really useful if you can not find the rootcase of your problem quickly in the internet. I hope it can help you even if it can be quite tricky.
Good luck!
Today I came to work, happy. But when I opened my Eclipse, I saw that one of my projects has errors.It's weird because it shows that it has errors only in the window bar, and not in the Navigator. I don't have any Java errors, this is a valid project that was fine all the time:
Some of the errors on the error log of Eclipse:
JavaBuilder handling ImageBuilderInternalException while building: SP_Procedure
Cannot connect to VM
File <SomeFile> has been skipped, problem while reading ('Resource is out of sync with the file system')
Unhandled event loop exception
Internal error
When I run an application from this project, I get a warning message but when I proceed, it works fine, but still. It's very disturbing and I'm not sure if it's harmless.
I tried to:
Restart Eclipse
Restart my machine
Clean projects and recompiling them.
Refresh projects
Pray
Nothing helped. What could be the problem? (I'm using Indigo Service Release 2)
The following nuclear option has desperation written all over it. But I have been where the OP has been with the Juno version of Eclipse.
Run a "Synchronize with Repository" and save all of your local updates to a different directory.
Delete the project. (Check the box to delete the contents on disk. Scary step, but that's OK, because you saved it in a different directory in the previous step, right?)
Read in a fresh project from the repository. It builds happily at this point.
Integrate your local updates.
Keep on praying.
Looks that one unused JAR was deleted, but for some reason, I didn't get errors in any file, even in the files that imports this JAR! So what I did was restoring this JAR, delete unused imports and deleted the JAR again.
I've found this error after two days of navigating on this project on each file.. This is weird that Eclipse didn't recognize that1 this is an error, and throw many unrelated errors such as:
Cannot connect to VM
File has been skipped, problem while reading ('Resource is out of sync with the file system')
Unhandled event loop exception
Is this a bug in Eclipse? (All errors and warnings are enabled!)
1 As seen in the image in the question..
A class from the list of imports for the file seems to have moved out or the jar file containing the class is missing.
Expand the imports section and check if you find some classes that are missing but have been imported.
Though it is a pain, sometimes the easiest solution is to back up all your projects (either in a repository or somewhere else on your computer) then uninstall and reinstall eclipse. No it's not fun, but it should reset eclipse so everything works again. The downfall though is that you have to reconfigure eclipse to any special settings you had/reinatall any extra functionality currently installed (eg. android add-on) and reconnect to any repositories you have. While punting isn't fun, it can be effective... I hope you don't have to resort to this though.
I have went through that problem a lot of times, and tried everything you tried. Rebuild, recompile, refresh, remove and add JDK, remove and reinstall Eclipse... nothing worked
The only thing I concluded is that the workspace metadata was corrupted.
What I did (every time it happened) was
Create an empty workspace
Import -> existing projects into worskpace
Mark the "copy projects" (else it will only link them)
Wait for the copy, and start working with the new workspace
If you work with SCM systems (Git, SVN, etc), making a full checkout will do the trick too, but the worskpace import will let you retrieve those changes you didn't get to commit (if any).
It's a little painful if you have somethings already set (like JDK names, servers, etc), but then I realized it was faster than keep searching how to fix the workspace
Regards!
PS : I've been working with Kepler lately, and everything works fine till now
Click Window -> Show View -> Other -> General -> Problems
This view will show you what is wrong.
Did you, by any chance, update your virtual machine outside of Eclipse? I can't help but feel that we're both missing a finer detail here. I just keep seeing "cannot connect to VM" and thinking that it's a major clue.
Have you tried running anything from the terminal? Does it work there?
If so, do you know where your current edition of Java is located? Is Eclipse looking somewhere else?
Is this exclusive to one project? Do you use any additional libraries to the JDK?
Maybe try this for Resource is out of sync with the file system error:
Right click project in Eclipse Package Explorer
Close Project.
Right click project in Eclipse Package Explorer
Open Project.
Other things not mentioned:
project properties > java build path, see if any of those tabs got changed, local file got moved? read/write permissions on some file you are linking to?
project properties > java compiler, see if workplace settings have changed? maybe under errors/warnings, you can systematically set them to 'ignore' until the error goes away to determine what type of error it is?
maybe update some of the eclipse plugins?
I saw something like this happening for a number of reasons. Mainly because of validation in files other Java source code. See if you are validating XML for instance.
Right click your project and chose Properties (Alt+Enter) and Validation to see the related configuration.
As for the danger, I lived with those marks for ages and nothing wrong ever happened.
I have a Java project in IntelliJ that compiles, and now I am slowly changing.
Is there a way to ask IntelliJ to run the project, even if some parts of the code still do not compile? If so, how?
Why I would need this, you ask? see this ticket:
IDEA-61945 Run and Debug commands should ignore compile errors not related to the main being run.
http://youtrack.jetbrains.net/issue/IDEA-61945?query=it#tab=Comments
Please, do not answer this post questioning whether I should or I should not need to run a project even if it does not compile. please.
If not possible in IntelliJ, is it possible in maven? How?
In Intellij 12 you also have the following option (which personally I find the best one):
Go to Edit configuration of your launcher
Go to the before launch section
If 'Make' is in the list: remove it
Add 'Make, no error check'
Now, when you run, a make will still be done automatically but the run will continue even if the are compilation errors.
Regarding the above debate; I think it makes perfect sense to be able to run a part of the code that does compile even if another part of the code does not not; e.g. if that other part of the code belongs to a module that is in your project but not involved when running.
I ran into this exact same problem at work today. Before now, I probably would have been quick to jump on the bandwagon of, "Why would you ever want to do that?" Turns out that Eclipse lets you do exactly this, and if you start working concurrently with other developers who depend on this feature (which is to say, check in code that doesn't compile), it's handy to be able to do the same in IDEA!
And lucky for us IDEA users, you can. Follow these instructions from the FAQ for Eclipse Users, and you're good to go:
To be able to run code with errors, you can select the Eclipse
compiler in Settings dialog, Compiler, Java Compiler and add the
-proceedOnError option to the Additional command line parameters for the compiler.
The only thing that's lame is that it's not quite as seamless as in Eclipse. First, you'll have to untick the option to Make before run because IDEA won't run if make fails. Then, you'll have to remember to build before running. With those caveats, though, you should be able to accomplish what you're after.
Stijn Geukens's answer is correct, but it can be improved.
In Intellij Idea version 12 instead of removing the "Make" rule it can be replaced with "Make, no error check". This way project will be rebuilt (compiler will atempt to do it), but it will run the program independently of compile outcome.
If you want to debug just one part, then you can create a unit test around that. If you do not use the class that does not compile, then you can still debug the unit test related code.
When there are compilation errors, you can exclude specific files from compilation.
Go to the Messages window (if it is not visible: View -> Tool Windows
-> Messages)
Right click the problem file
Exclude from compile
At least in Intellij 12 you can achieve this.
First try to compile the project, including the broken class(es).
Then in the Messages view, containing all the compile errors:
Right-click the class you want to exclude
Click 'exclude from compile'
See this question on how to reinclude afterwards.
For Intellij 2017.3.1 my configuration is like this:
Use the Eclipse Compiler: Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Use compiler: Eclipse
Select "Proceed on errors"
Edit your desired configuration defaults (I use this for JUnit) before launch to Build, no error check: Check this screenshot
Additional step in order for Intellij not to open the classes with errors when you run your configuration. Un-select Automatically show first error in editor in Settings -> Build, Execution, Deployment -> Compiler
PS: This configuration is not perfect for all usages. It only works when you are fixing unit tests that were failing because of your changes in implementation code. When you go back to implementing features it is more useful to disable this feature since it will let you run you implementation code with errors and it will not jump to compilation errors. You need to go back and forth with changing the Eclipse compiler with the Javac one for best results.
Wow, it's been a while since I've been in IntelliJ and I miss it dearly! From my recollection you should be able to right click the main method in a module and run it directly so long as the remainder of the files in the module compile. I don't think it matters that a second module in the same project has errors. Is that not working for you?
updating for version 2017 - 2.5 community as menu options are slightly different
Navigate to:
Run>Edit Configurations
near the bottom of the Run/debug config window look for
"before launch: Activate tool window "
the field below this heading lists your current build config settings.
Use the + and - symbols in order to add and remove build preferences.
Once completed
Select apply then Okay
Thats it!
I don't think its possible at all. How you can run something that doesn't compile? That would be like driving a car that isn't put together. You could comment out the files that don't compile, so that the project compiles....
Edit -- or you can have Intellij not count the file as source by
Right Click on your project -> open module settings -> select your module -> select the file -> excluded
I'm building an Android app.
I worked today on my app, and suddenly I saw that all the projects in the workspace are marked with an error. I don't know what caused it, and I can't find explanation of the error anywhere.
I'm using Helios with Windows 7. I even tried downloading Eclipse again but it didn't help.
Today I tried to integrate Facebook with my app. Their tutorial required me to try to get a hesh key from a keystore. In the process I added an Environment Variable named JAVA_HOME, and pointed it to the JDK.
I don't know if it's the cause of my problem, but I think it might be related.
I really don't know what to do.
Thanks!
Try this. In eclipse, go to Project --> Clean --> Select "clean all projects". This should rebuild all projects.
Try cleaning your android project. I get problems with Eclipse sometime, and if I clean the project, it fixes it.
Find the "Problems" view. That will give you more details. Post the description of the problems, we can get more information.
click Window -> Show View -> Problems
Typically, the problem is with a resource you've recently added to your project (drawable, assets, raw, etc.)
Some things to check are:
Invalid XML files
Invalid 9-patch images (outer 1-pixel border must be full black or transparent)
Typically, just start by removing a resource, then cleaning your project (Project > Clean). If the errors go away, that resource is your problem. If not, continue this process until the error DOES go away. Start with the most recent resources you've added, naturally.
i solved error or all project showing errors this way.... close eclipse.
then Right Click on eclipse shortcut-->open file location-->open command widows there and type "eclipse.exe -clean" eclipse the starts..and in my case errors were gone...hope it helps
I'm using Eclipse for Java development. All my sources compile fine and the resulting application compiles fine. However, I keep getting an "red-x" error notification in the Package Explorer.
All my sources in this source directory (too long for the snapshot) compile fine, none of the show the "red-x" error icon.
Any suggestions on how to fix the problem would be highly appreciated.
yeah, this happens sometimes for no apparent reason. You can go to the "Problems"-Tab (right next to console output) and see the error message, so maybe you can narrow it down that way.
This happens often when I use Maven, and I had always ignored it until I found this question. You need to update the project in this case (figured this out by looking in the Problems pane)
From the project context menu: Maven -> Update Project and select the available maven codebases
Alternatively you can use (Alt + F5) to bring up the same window
Try to clean the project and rebuild it.
After build. Refresh project and if still persist just right click Problems tab in eclipse and choose delete all.
It often happens if you do maven install and eclipse properties files do not get updated properly. Even though your project does not have any errors. Hopefully!
I want to start by thanking everyone that answered. But cleaning and rebuilding was not enough in my case because the problem was still there and needed fixing.
Turned out that one of my package directories had accidentally been copied so that an extra directory now existed called "Copy of dagskra" containing Java files with wrong package declarations. In addition the errors in this "new" directory don't show up with a "red-x" in the package that it exists in:
Snapshot from Package Explorer showing errorous "Copy of dagskra" directoryr http://www.freeimagehosting.net/uploads/a824304b18.png
It was the hint of reading the "Problems" tab :-) that turned me into the right direction, so I'm selecting that answer as the accepted answer because this is what I needed:
Snapshot from Problems tab http://www.freeimagehosting.net/uploads/dea26d5dd0.png
Hoping this will help others...
So upon finding that there could be a missing package in the buildpath, thus the red x against the main project, to remove this:
1) go into "Configure Buildpath" of project
2) Java Build Path -> Source Tab - you should see the red x against the missing package/file. if it no longer exists, just "remove" it.
red X begone! :)
Sometimes there are build path errors in .project, and you need to switch to Resource view to actually see the file that is causing the error.
As others have said, bad file references in the build path is often the culprit.
Usually a .jar file that has been moved/deleted. Eclipse expects to find everything referenced on the build path at the location specified, and will complain if not.
I had the same issue and below steps resolved the issue:
Delete the JRE from PROJECT> properties>java build path> libraries.
Restart the eclipse
Add the JRE again
Rebuild the project using Project>Clean and chose option to build automatically.
Please try.
Subversion is occasionally the culprit for this as well. It might not have anything to do with your environment. But, there might be a discrepancy between the current and local state of the project. In my case, doing an update, and then a commit to the subversion server provided me with the expected clean result without any flags in the project such as the X.
In my case what solved this problem was simply to Close Eclipse and opening it again...However I am still not sure why this happened or why it worked. I was having problems Cleaning my project (it said it could not Delete certain file) and this solved it :):
Try doing a rebuild. I've found that the red x's don't always disappear until a rebuild is done.
I've run into a similar problem many a time, what happens usually for me is that a java file will say it won't compile in the text editor but in the package explorer it will say it's compiling fine.
Sometimes doing a 'rebuild' or 'clean-build' doesn't work, the files don't actually get built (one has to presume that eclipse thinks the files it has are up to date) and when this happens I usually open up the java build path and just move one of my dependencies down/up the pecking order. This forces eclipse to do a rebuild of everything and it always seems to work.
If you're still having problems try copying the project and seeing if you get the same behaviour and at a last ditch attempt post a bug for eclipse, it may take a while for them to fix but at least you know that you're being heard.
To add to the previous answer, an extreme way of "cleaning" your project is to delete it (that is deleting its reference from the workspace, not deleting the actual files), and then re-import it.
Sometimes, it helps...
FindBugs also puts a red-x against files/packages to indicate static code analysis errors.
I have run through this. My case was more involved. The project was packaged fine from maven command line.
Couple of things I made.
1. One class has many imports that confused eclipse. Cleaning them fixed part of the problem
2. One case was about a Setter, pressing F3 navigating to that Setter although eclipse complained it is not there. So I simply retyped it and it worked fine (even for all other Setters)
I am still struggling with
Implicit super constructor Item() is undefined for default constructor. Must define an explicit constructor"
I also experience those misterious error-symbols on packages from time to time. A way to get rid of them that works for me is to effectively remove the JRE System Library from Java Build Path and add it back again.
My solution that finally worked was to clean all projects, close eclipse, clean all projects, close eclipse, and so on at least 5-6 times. Eventually it all settled down and everything was as expected. Weirdest thing ever!!
And no there were no errors in the Problem or console view.
Also this happened after a computer crash. The last time it happened my whole workspace was completely lost. It was still there on the computer, but when I tried to access it, it would be all blank.
For whatever reason computer crashes are really really really badly handled by eclipse.
Also, you may update the project by clicking,
Right Click on project name -> Select Maven -> Right click -> Update Project.
This helped out for me.
Thanks.
This can occur for a number of reasons. If you have changed the jdk, the Project facet will have a red X next to it while no other folders shows an error. If this is the case, modify the jdk that is shown. This happens on occasion in our JAX-WS class (HSG
I solved mine by
Close all other projects (i.e. unrelated project option)
Clean and build
My project was android, and that did it.
This happened when i downloaded fabric.io on Eclipse Mars but Restarting computer solved this problem for me.
i had same problem. I checked "Problems"-Tab and found no server for the project. I defined the server. the red-x disappered
You can go to project-> Buildpath-> Library
If there is any library that is X marked ie [cross marked] removed it and again try to build. It worked for me as well/
I encountered this problem today and found this link. I followed as mentioned by Patrick Schaefer above and opened the Update Maven project Dialog. Click on my working project and selected the checkbox "Force Update of Snapshots/Releases" and 'Ok'. All the red cross vanished.
I hope this helps anybody in a similar situation.
The question is old but I had this issue and I tried the following to no avail.
mvn update (with snapshots)
remove project and re-importing
clean build
restarting Eclipse
changing order of items in build path
In my case I've got multi module mvn projects and one of the nested projects was showing a red X icon only in the Project Explorer (package explorer and problems were totally fine) and the whole project was fine as I could run classes without any issues. So seemed like a display issue.
The only thing that worked for me was to edit the pom.xml if the offending project module and make a breaking change (add 'xxx' to a tag name) which caused 1000s of errors and then undo.
You may clean the project by clicking,
In Eclipse, Right Click on Project -> clean
This helped out for me and saved a lot of time.
Thanks.
Right click on the project with errors, then in the sub-menus select:
Maven > UpdateProject >
and then:
Select the checkbox for all the dependent projects
select force update of snapshots
click OK.
This worked for me..