I am using Eclipse 3.5 and I attached the src.zip to my global settings in Eclipse. Windows--> Preferences -->Java -->Installed JREs -->rt.jar - Source attachment - ...../jdk/src.zip
I am successfully able to step in the java core library .class files and view the source code. I building a Class which uses the LinkedList and I have set a breakpoint inside the LinkedList class.
When I debug the breakpoints in my source code (my projects) are working good but when I need to step into the java core lib .classes I get the following error in my Eclipse
Unable to install breakpoint in java.util.LinkedList due to missing line Number attributes. Modify complier options to generate line number attributes.
I checked my complier settings in Preferences and found all options checked true. It would to great if someone can help me resolve this issue.
Thanks in advance.
Clicking anywhere on the class name that we want to open and pressing F3. Clicking anywhere on the class name and going to the menu under Navigate > Open Declaration.
In order to decompile class file, just open any of your Java projects and go to Maven dependencies of libraries to see the jar files included in your project. Just expand any jar file for which you don't have the source attached in Eclipse and click on the . class file.
A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.
You may have the compiler set to include debugging information in YOUR class files, but the class files in rt.jar weren't compiled that way. You need to either recompile all the source for the classes in rt.jar (not for the faint of heart), or download a debug build of the jdk.
This blog posts give a comprehensive list of points to check
Follow the steps if you are compiling using Eclipse IDE
- Go to
windows > preferences > Java > compiler
screen.- Make sure that add line number attributes to generated files (used by debugger) check box is checked.
- Build again and try adding a breakpoint ahd hope it should work for you.
Note for ant builds
Follow the steps if you are compiling using ANT utility:
- Check the build.xml file and make sure that debug attribute is set to true in javac task
- Also, if you are using JBoss as an app server, then make sure that you have already opened a port for socket binding of remote machine connection. If not then just ensure that
C:/jboss/bin/run.bat
has an entry with:
"set JAVA_OPTS=%JAVA_OPTS% -Xdebug –Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n
" for opening port 5000 to listen all socket connections for debug/remote java application.- Build again and try adding a breakpoint ahd hope it should work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With