Refactoring, Renaming, and version management

I’m using the netbeans IDE to write my Java and overall I think it’s excellent. It’s a completely different experience to perl coding where my idea of version management is to save-as a different filename. If I want to rename something in Perl I do just that. With modules it’s a bit more involved but not that tricky.

I was writing a Java program to interface with a SQL server. This program morphed into something completely different so I decided it was time to rename it. Now what?

I discovered refactor->rename. Brilliant! rename to something else, job done. I re-compiled and ran it and got this:


Wha? sql_test1 was the old name, not the new name. The files had all been changed, what’s the deal? ok, google: java netbeans NoClassDefFoundError after refactor . Now sort through the results. No joy. I found that the file had the old name for main.class. Haha! Changed it to the new name. Then I got the same error except with the new name. What gives?

Eventually I found an article here where I found the answer: A) don’t use Main, your program to something else and B) The class must be capitalized! That’s what tripped me up, I had it in lower case. Once I renamed my class to be capitalized it all worked fine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.