I'm trying to debug my Java application in Eclipse however when I hit a breakpoint I simply see the following instead of my source:
If I change the stack frame in the Debug window then I can see the function name change in the tab - this is definitely my code, the line number is correct and I'm using the latest build but I still can't get Eclipse to show the source (despite it being open in another tab!)
I'm new to Eclipse and so I'm struggling to find my way around, but everything that I've stumbled across so far seems fine to me.
What might cause this to happen and how can I fix it?
Sounds like the 'source lookup path' section if you edit the debug configuration isn't setup correctly?
Click on "Edit Source Lookup Path" button and then click on Add button then Java Project and include your imported project .. Hope this will solve your problem
I also had this issue in MyEclipse Blue. I resolved it by following these steps:
Debug the project.
Right click on the Thread (Which you will see in Debug tab) and click on the "Edit Source lookup"
New window will open and hit the "Add" button and Select the "Java Project".
Get all the project that is listed over there.
Restart your server.
I had similar problem with my eclipse maven project. I fought with this issue quite a long time then I tried to rebuild projet with
mvn clean eclipse:eclipse
and it helped.
When I faced this problem for the very first time, I've already done all the steps mentioned here. Curiously, my problem happened when I've copied a project into another place. Anyway, the debug starts to work without warnings, after simply remove all breakpoints that was originated from the original project.
Sorry about my English , I'm not fluent.
We had the same problem and none of the suggestions above worked. What did work, was deleting the local workspace and from Eclipse checking out from the repository again. The problem occured for everybody previously working with Netbeans and making the switch to Eclipse.
Try this:
Select Project
Right click
debug
Debug configuration
Select Source Tab
Click on add button
Select Java Project
Add your project there with check box
For local projects I've solved it by selecting the "Resolve Workspace artifacts" checkbox in the Debug Configurations.
This is a common error while debug in eclipse. You can fix it through edit source look up. But make sure once you attach the Project You need to stop the server and again start in Debug mode. It will work.
Here is the detail steps :
Click on "Edit Source Lookup Path" button .
Then click on Add button.
Select Java Project and include your imported project
Then stop the server and start it in Debug mode and hit your service. It will work.
After trying most of the solutions here, try this too once -
Close all the .java files from the editor, in fact, close all unrelated projects in eclipse.
And try running the Debugger.
I solved this problem by adding the class file into the src folder within the project. Hope this method may help.
I got this error when I was running my server using a maven tomcat plugin. When I deployed using my configured server in Eclipse (generating a war file and copying it into my tomcat directory), I didn't have this issue anymore.
In your debug configuration add goals as "clean install"in the maven build con
This is an expansion on JAB's answer:
Click "Edit Source Lookup..." > Add... > Workspace Folder > Project > select your folder > check Search subfolders box > OK.
In Eclipse:Window-->Go to preferences-->Java-->Click on JRE-->Edit--->Restore Default and click on Finish.
Update your Project before Debugging the code!
Alas! It worked for me.
This occurred to me when my working git branch is updated from code in master branch. I have already run mvn clean install after the pull, but seems I had to update projects after the maven build so that project source code and JAR build code gets synchronized.
Right click on your project -> Maven -> Update Project, then select all the
maven modules available and press OK. This resolved the issue for me.
I was facing same issue. After banging my head for several hours, I finally noticed that although Maven was building the project successfully, the source file I was trying to step into had an incorrect package statement and that is why the 'Source Not Found' eclipse problem was happening. When I corrected the package statement and rebuilt the project, the debugger found source file and stopped on my breakpoint.
Related
While compiling an android project in eclipse 3.4.2, I am getting The project cannot be built until the build path errors are resolved.
I got a temporary solution from the blog http://www.scottdstrader.com/blog/ether_archives/000921.html
The resolution was to force a resave of the selected projects (and their .classpath files):
Open the project properties
Select Java Build Path > Libraries
Add a new, arbitrary library (to be deleted later) > OK
Wait for the workspace to refresh (or force a refresh of the project)
The error(s) will go away
Remove the dummy library
The only other references I could find were to make minor alterations of contents of the .classpath file.
Is there any permanent fix for this issue?
Have you tried using Project > Clean... from the menu? This will force a new build on the selected projects in Eclipse.
1-Right CLick on your project folder, Choose Build Path > Configure Build Path
2-Select Libraries Tab and delete any arbitrary library present there.
3-Click on Add Library option, Select JRE System Library and click Next.
4-Choose last Radiobutton option Workspace default JRE and click Finish.
5-press f5 for refresh.
6-run ur program .
This what fixed it for me...
I was having an issue with my spring-core.jar.
I deleted the entire release directory located here. (I'm on win 10).
C:\Users********.m2\repository\org\springframework\spring-core\4.3.1.RELEASE
I right clicked on the project > Maven > Update project and my exclamation mark disappeared. No problems any more.
Here is the source where I found the information:
http://crunchify.com/cannot-be-read-or-is-not-a-valid-zip-file-how-to-fix-maven-build-path-error-with-corrupted-jar-file/
This happens when libraries added to the project doesn't have the correct path.
Right click on your project (from package explorer)
Got build path -> configure build path
Select the libraries tab
Fix the path error (give the correct path) by editing jars or classes at fault
This works for me: close the project then re-open it, this will force eclipse to reload a fresh project and detects the correct build path.
None of the other answers worked for me. Even after fixing my build path issues, doing a refresh, clean, rebuild, and restart (of both eclipse and the computer), I was still getting the little red exclamation point.
I fixed it by closing the project (right-click, close project) and reopening it (double-click the closed project), which seemed to force eclipse to "notice" that the build path problems had been corrected.
For my mac osx Eclipse, I followed following steps:
Right CLick on your project, Choose Build Path > Configure Build Path
Select Libraries Tab and delete any arbitrary library or anything else causing errors in Build Path.
Click on Add Library button, Select JRE System Library and click Next.
Choose last Radiobutton option Workspace default JRE and click Finish.
Clean and build your project.
get a cmd and run
mvn eclipse:eclipse
This is what worked for me:
Go to ~/.m2/repository and deleted everything there by running rm
-rf. Make sure everything is deleted.
Re-launch eclipse or STS
Right click on project -> Maven -> update project.
On my Mac this is what worked for me
Project > Clean (errors and warnings will remain or increase after this)
Close Eclipse
Reopen Eclipse (errors show momentarily and then disappear, warnings remain)
You are good to go and can now run your project
I've seen this problem a few times (got it again right now on my home computer with Eclipse 4.2).
Forcing a resave (by changing the classpath e.g. by adding a library, save, change-back) works temporarily. But the problem comes back when Eclipse is restarted :(
Nuking the Eclipse workspace from orbit will permanently fix it (until next time). But there must be a better way!
just check if any unnecessary Jars are added in your library or not. if yes, then simply remove that jars from your library and clean your project once. Its worked for me.
In Eclipse this worked for me: right click project. -> Properties -> Library Section; Add (any library at all) -> select library and click remove -> press okay.
I ran into this annoying issue with the Play framework. It would be nice if there was some way of knowing what build errors Eclipse is unhappy about, but it's not going to tell you. With one project, I was able to close the project, rebuild the Eclipse configuration with sbt eclipse, and reopen. With an almost identical project, that didn't work. But deleting the project, rebuilding the Eclipse configuration with sbt eclipse, and importing, did the trick.
If you think you've done everything correctly but Eclipse still complains about the jars, refresh the folder where the jars are and make sure eclipse knows they've been added to the project. Specifying the file path alone is (apparently) not enough
I've faced this issue a couple of times and following the below steps has resolved both the times.
1. Navigate to C:\Users\
2. locate the ".m2" folder and delete it.
Now navigate to the particular project in eclipse and Right-click on the project > Maven > Update Project
wait until the project is updated and in my case following the above steps resolved both the times.
I was getting an additional warning
The compiler compliance specified is 1.6 but a JRE 1.8 is used
Resolving this warning make the error also go away. The steps are as follows:
I right-clicked on it, then clicked on Quick Fix. From the dialog that opened I selected Open the Compiler Compliance property page, and clicked the Finish button.
(This is same as Java Compiler section.)
In this dialog I found the Compiler compliance level drop down and changed 1.6 to 1.8, and clicked on Apply and close.
I got a message box Compiler Settings Changed which asked if I wanted to Build the project now?. I clicked on Yes.
The build path error went away.
Go to > Right CLick on your project folder > Build Path > Configure Build Path > Libraries Tab > remove project and external dependencies > apply & close
Now, Gradle refresh your project.
Added below to pom.xml file and it worked eventually:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
Goto to Project=>Build Automatically . Make sure it is ticked
I'm fairly new to Intellij and Java and am unable to use libraries from one "module" in another. I am seeing red class names and getting "Cannot resolve symbol ..." errors all over the place:
The other modules are referenced in File | Project Structure all the other module's Paths are correct and include the *.classes I'm trying to use:
I have also tried a File | Invalidate Caches but am still having the same problems.
What do I need to do to fix this?
Listed below are steps which may fix the problem:
1.Invalidate and refresh the IntelliJ's caches
File Menu -> Invalidate Caches / Restart -> Invalidate and restart
2.Project SDK selection
Check project settings from File Menu -> Project Structure
Ensure an SDK is selected for the Project SDK. If is selected, click the 'New' button, select JDK and then select the correct path to the JDK e.g. /opt/java/jdk1.8 or c:\Java\Jdk1.8
3.Corrupt JDK
There may be a problem with your JDK installation, re-install JDK
4.Re-import the project
Close the project if it is open in IntelliJ
Delete the .idea folder in the project source code folder.
Start IntelliJ and Import the project.
You can choose any of them which will work for you.
I faced a similar problem for no reason, I think it was caused by IDE(android studio). I have tried all of the above solutions but not worked. Finally, in my own situation, I solved this problem by the following actions:
Delete your .idea folder in your local project.
Reopen this project and just let Gradle run itself.
It was worked for me. I hope that my experience will be useful for you.
You need to add your external libraries/classes under dependencies in order for IDEA to see them when doing code analysis/autocomplete.
You can go to "File->Project Structure"
From "Project Settings", Select "Project" tab and there make sure that "Project SDK" has proper JDK selection.
After you add dependencies to POM file, make it a habit to refresh POM by clicking on the 'Reimports maven projects' icon. Its the first icon in the maven tool window located to the right of the main intellij editor. Its a blue icon with 2 circular arrows. Clicking it ensures that the added dependencies are fully integrated into your project
Run it from the project's root folder.
$ mvn -U idea:idea
One more advise would be to make sure that you import the project properly. If it's a maven project, import pom.xml and if it's a gradle project, import gradle.build file to make sure that all the dependencies are downloaded correctly.
Just got this.
Just went there.
Invalidated the cache.
Seemed to work until I wrote further lines.
Then noticed that I was writing my code outside of the main() function.
Moved the ending curly bracket further and voila.
I made a HelloWorld app in Eclipse that had no errors and runs fine. It was located in
Android/workspace/HelloWorld
Then I created a Git repo elsewhere in, say
Git/MyApp
I want to have MyApp contain the HelloWorld project from eclipse, and when I make edits to HelloWorld, it will show up in git status and I can commit and push those changes.
I tried copying the HelloWorld directory from the workspace into MyApp, then pushing my changes to my repo, which was fine.
Then I deleted the original HelloWorld in the workspace, went to Eclipse, hit import existing project, and selected the HelloWorld from the MyApp repo. But this resulted in a ton of compilation errors. How can I do what I'm trying to do without all these errors?
I've attached a link to a screenshot of the errors I get upon compilation.
I have Understood your problem,your project have a relationship with appcompact.Whenever you import your project you have to check below scenario,
Right click your project ---->select properties--->In side bar select "Android" Tab--->now you can see Project build target and Library Box--->in Library box click add and choose appcompact project and then click apply.
After done above one clean and build your project.Then it will work fine.
try Clean operation on your project and then build your project. replay whether it solves the issue or not.
As a matter of fact it looks to me like your eclipse doesnt recognize your app-compat anymore.
This happend to me once too, after I closed and reopend the appcompat-project.
Try to close all your projects -> open the appcompat first -> restart eclipse and maybe do a clean on your project
Hope this helps.
Since last night, Eclipse hasn't been letting me run any of my projects and gives me the error "Your project contains error(s), please fix it before running it".
This happens regardless of which project I use.
There are no code errors in any projects
There are no missing files (R.java, etc.) or folders (src, res, etc.)
There are no errors in the console (even on verbose) or the error log screen
I've cleaned all the projects, and each individual project many times
I've restarted ADB, Eclipse, and my computer
I have no idea what to do next, so hopefully its fixable.
NOTE: I am using Git, and this occurred after switching to my master branch to export a new update to one of my apps.
Thank you in advance! (:
Edit 1: I have also tried deleting and re-importing the projects before I posted this.
Click Window -> Show View -> Problems, that should show what exactly Eclipse thinks is wrong with your project. Sometimes you can simply delete the problem from that view, and Eclipse believes you everything is fine (yep, weird, I know).
Also, after you switch branches using an external source control tool (one not integrated into Eclipse through a plugin), Eclipse sometimes won't pick up all changes, you'd need to manually refresh the whole project file tree.
If nothing else helps, try setting up a new Eclipse workspace and importing your project there.
check your build paths - there could be jars and dependencies that are outside of the app that need to be opened or imported.
another trick is to edit an xml file, just change one word to intentionally cause an error, save the file, then change it back to proper syntax and save again. Error magically disappears.
another trick is to edit a java file, (cause error, save, fix error, magically error free)
I had this problem and I have fixed it. My issue was this:
I somehow managed to require another project in my build. That project had errors in it, which I believe is what caused the issue. I think this happened when I accidentally asked Eclipse to fix my build path or something when I was trying to fix a mistake. To correct this issue go to (on mac):
Right click on your project folder in the Package Explorer
In the menu, go to "Build Path"
Select "Configure Build Path"
Go to the "Projects" tab (along the top).
Is there anything in there? If there is and you weren't expecting there to be, select the project that is in that folder and hit "Remove"
This fixed the issue for me. Hope it helps.
I think you need to clean your project. Do project -> clean. Should work fine after that.
Try using Project->Android Tools->Fix Project Properties besides checking for your Android path. Check if your ANDROID_HOME and ANDROID_SDK are set correctly besides adding tools and platform-tools are set correctly in environment variable PATH.
Hope this helps!
Go to your .android folder and delete your debug certificate.
E:\Users\(your profile)\.android
Inside that folder there is a file name 'debug.keystore'. Delete that, clean and try to build the project again. Sometimes this error is caused when the certificate expires.
I found this answer here and it solved my problem ;-)
I think go to project ->clean some error can be solve this problem
Go to Projects in the menu bar
Then check the menu Build Automatically.
This helped for me.
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..