How to debug Java code when it is out of sync?

One of the problems I'm running into is that my jar files and my source files don't match.

I'd like to:

  1. Be Notified when when source and binary don't match (I think Visual Studio can do something like this...)
  2. Set break points not by line, but by function. For example, set a break point at the entry of function foo().

I use eclipse mainly; so Solutions for eclipse would be most appreciated, but any IDE (or command line debugger) will do. Thanks!


When developing just use and link to .class files that are saved by your IDE.

If your project starts to grow to a point where it's really useful to link to a .jar you're better off treating the jar's as separate projects.

The debug information is limited to line numbers in the source file... I do agree that having a warning that the lines are wrong would be nice, but that would require more meta data in the jar than I think is available...

You might want to consider addressing the challenge with a change in your build process. This isn't exactly answering your question, but hopefully it will give you a strategy that will address the underlying problem.

When you generate the jar for deployment, also generate a jar with the binary AND source. For investigating the source code of a stack trace on the live server, set up a separate project in eclipse and have the binary+source jar be on the classpath. You may have to explicitly set the source code location back to the same jar (though I think Eclipse will just do this automatically).

Then you just have to add copying of the binary+source jar into the appropriate location in your workspace as you do your deployments (preferably with a deployment script).

If it's your server, you may want to even consider deploying the binary+source jar to the live server - that way you will always be able to get at the source.

Use method breakpoints instead of line breakpoints. They can be set to halt on entering/exiting a method. You get them by double clicking the left editor side in a line containing a method declaration.

Need Your Help

Multiple InfoPath interop automation instances

c# windows-services infopath office-interop office-automation

I am trying to automate multiple parallel instances of Office InfoPath 2010 via a windows service. I understand automating Office from a service is not supported however it is a requirement of my

Virtual webcam input as byte stream

c# c windows directshow

I dont have webcam. And I want to implement virtual webcam (or fake device driver may be) that would work as normal webcam(virtual webcam) and takes memory stream or bytes as input. How can I develop

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.