BlackBerry Development With Eclipse Plugin – Fixing Corrupted *.jdp File

It's not a secret that Eclipse plugin is very buggy and although it has improved a lot over the time, [intlink id="75" type="post"]the blackberry plugin still has a lot of issues and quirks[/intlink]. One of the problems that have been bugging me a lot was that sometimes the *.jdp file gets corrupted. This is the file where BB plugin for Eclipse saves most of the meta data for the project, including the files that are included in the project and consequently need to be compiled. So, many times I had problems with SVN meta data files corrupting this project, or sometimes perfectly legitimate *.java files that get stuck in the *.jdp file, but do not exist anymore. The result of the *.jdp file being corrupted is that your application does no longer get compiled and redeployed when you run it. And the worst part, Eclipse would not explicitly let you know about this. It would silently fail and not re-deploy the app. So unless this is the first time you run the application, or the changes you made are not visually obvious, you would not know about this. But this is completely separate issue. One of the many issues with BB Eclipse plugin already covered. Each time I have been struggling (sometimes for significant amount of times). Couple times I was able to manually delete files from the *.jdp file (although this is not recommended by RIM) and this solved the problem, but mostly I had to recreate the whole project from scratch, which if your project is large and, which is more important has dependencies on libraries, may become painful if you need to do this every few days.

So the easiest way I found so far to solve this problem is:

  1. Delete the *.jdp file (you can just rename it to *.jdp.OLD)
  2. Delete the project from Eclipse (right click the project and choose delete). DO NOT however check the checkbox "delete the contents of the project from disk"
  3. Create a new project and point it to the same place.

Since all the Eclipse project related files remain untouched, you should get your project exactly at the same state it was before it got corrupted, minus the corrupted part. Why - because when you re-create the project Eclipse plugin should re-create the *.jdp file.