Wednesday, January 19, 2011

Unable to install breakpoint due to missing line number attributes

It would stop you add a breakpoint to your code. The detailed error description that comes as a message box says

Unable to install breakpoint in xyz class due to missing line number attributes. modify compiler options to generate line number attributes.

Reason: Absent line number attributes in generated class file.


1. Verify the class file generation options in eclipse

Go to windows > preferences > Java > compiler screen.

Make sure that add line number attributes to generated files (used by debugger) check box is checked.

2. In the build.xml, set debug attribute to true in the javac task.

Wednesday, January 12, 2011

How to add struts capability to a existing core java project

With my earlier projects where we had the struts plug in added to the eclipse. all we used to do is right click on the project and -> Add Struts capabilities. Here it doesn't work since the plug in isn't there. So here is the alternate approach.

1. Go to your Eclipse project folder and you should see a file named ".project" open the file.
2. Search for these lines org.eclipse.jdt.core.javanature
3. Change those lines to become
save the changes you have made.

4. Open one more file called “org.eclipse.wst.common.component” under your ".settings" folder inside your Eclipse project folder. If there is no ".settings" folder inside your project or empty one, you can use from other Eclipse Struts Project, just copy it over.

5. Change the some parameters
Pay attention to (you can ignore other, the application_name usually the Eclipse project name) :
the source-path is relative to the location of your .java files.
the deploy-path is relative to the location of your .class files.
the context-root is the application name, usually the war name or the war-extracted folder name on the server.

4. Close your Eclipse project and open it again.
5. Right click on your project and go to the Properties menu.
6. Choose the Project Facets, select Dynamic Web Module and Java by active the checkbox
respectively(for my case i choose version 2.5 for the Dynamic Web Module and 5 for Java). Click OK.

Hope it useful.