Trying to debug my eclipse - java

I am using JDK 1.7 on my eclipse. I am running Maven Build. I have recently tried to debug my application and at first it would take me to a blank page that only gives the option of "edit source look up" after editing the source look up it still does not work. I have also tried cleaning my project( i have done this numerous of times). I have even checked out a new project and redirected my server to the new folder and it still wont let me debug. I Need help as soon as possible

Try Window -> Preferences -> Maven -> Download artifact sources. After that right click on your project: Maven -> Update project -> OK.

Related

The project cannot be built until build path errors are resolved [duplicate]

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

Showing JavaDoc/ScalaDoc for Maven/Sbt managed projects in IntelliJ IDEA

I'm using IntelliJ IDEA 13.1 Ultimate. For not Maven-managed or Sbt-managed Java/Scala projects, autopop documentation showed up fine. But for Maven/Sbt managed projects, JavaDoc/ScalaDoc does not show up. The dialog box will appear but there's nothing inside.
Make sure you have configured source path for JDK/SDK correctly (Project structure -> SDKs)
and Maven is configured to download sources/docs automatically (Maven -> Importing).
You can also check Settings -> Editor -> Show quick doc on mouse move setting.

Using Git with Eclipse causing lots of errors

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.

Eclipse Debug: Source Not Found while remote debugging

In my Java eclipse project, while I am remote debugging, eclipse does not step into the class files of imported library files even though the source file jars are properly mapped to the library files.
Instead it gives me a "Source Not Found" error. But when I am editing the same class in eclipse, I can control-click a class or method name and it takes me to the correct library class file.
Can anyone please tell me what I am doing wrong?
I am using Tomcat 6 and latest Eclipse Java EE.
In this scenario just follow the following steps:
Go to Run → Debug Configurations
Select the remote application configuration being debugged.
Select the second tab named 'Source'
Now add the folder/projects containing the source code explicitly here.
In the Java build path for the project, under the sources tab, check if your class path is under the included list. If its under the excluded list, remove it from there.
As Saury said, get your debug configuration right. When remote debugging, often developers have selected the wrong project while creating a new configuration. Verify you select the project you wish to debug and it corresponds to the version of the deployed WAR/EAR/JAR in the appliation container.
I faced same issue and got solved by below steps in eclipse.
Go to Severs tab in your Eclipse tab
Right click on the server and click on Add and Remove Projects
Select/add the project EAR which you want to debug
After finish - Start your server in debug mode
Should solve with above steps as it resolved for me:)
I ran into a similar problem. It turns out I was missing the devel package on CentOS.
In my particular case, the following yum statement solved the problem.
yum install java-1.7.0-openjdk-devel
Follow the next steps in case you use a parent project connected to sub-project/s:
Use the 'Debug Cofigurations' source tab or the 'Edit Source LookUp path' option to attach the sources of the running code.
Note: you'll need to attach the src folder of your inner project rather than the target in order to make it work (check the screenshot below).
E.g.
An update for eclipse Oxygen (Feb 2018):
Attaching the Java projects (sub projects) also worked well; e.g:
Check under "Debug Configurations" -> "Remote Java Application" -> Tab "Connect" -> "Project" that you chose the correct project.
Here is how it worked for me. Did this on Eclipse oxygen
Go to debug configurations and then the source tab
Click on Add
Select Java Library. Hit ok
The select Web app libraries and click next
In the next screen select the project/application that you are
debugging.
Click Finish
This worked for me like a charm
Using Eclipse version Oxygen.2 (2017), the accepted answer did not work for me. The following procedure was successful.
Launch the application to debug with the Xdebug and Xrunjdwp switches.
cd "C:\Program Files\Test_742\Test 7.4"
test_app.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8500
Create a new workspace in Eclipse.
Create a new Java project using File -> New -> Java Project.
Copy the source code of the Jar to debug to the src folder of the new project. I found it necessary to ensure that I copied the complete folder hierarchy of the source code to my source folder.
For me that meant copying \com\test... to my src folder.
This puts all the source code in the build path.
Copy any dependency JARs to the project. I created a new folder named myJARs.
Refresh Package Explorer to see the new myJARs folder.
Add the dependency JARs to the build path by opening File -> Properties -> Java Build Path -> Libraries (tab), and click Add JARs...
Add each dependency JAR to the list, then click Apply and Close. This adds the JARs to Referenced Libraries.
Configure a debug session. Click Run -> Debug Configurations -> Remote Java Application. I set Connection Type = Standard.
Configure Host to point to the machine running the JAR and Port to the port specified in the address portion of the command line switches (8500 in my example).
Notice that on the Source tab, both the source files and the dependency JARs are present.
Click Apply, then Debug.
View the debugging perspective by clicking Window -> Perspective -> Open Perspective -> Debug.
Place breakpoints in the source code.

I get "Source not found" when debugging my Java code in Eclipse

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.

Categories

Resources