Search code examples
javaruntime-errornoclassdeffounderror

java.lang.NoClassDefFoundError ... (wrong name: ....)


I know there are already several posts about this but I couldn't make any sense of them.

I have build a custom DateSpinner with a MVC pattern:

package my.app.myDateSpinner  // public class MyDateSpinner
package my.app.myDateSpinner.controller // public class MyDateSpinnerController
package my.app.myDateSpinner.model // public class MyDateSpinnerModel
package my.app.myDateSpinner.view // public class MyDateSpinnerView

The code is located in:

c:\My Code\src\my\app\myDateSpinner

I'm using Dr.Java and I have added to the classpath:

C:\My Code\src

Now I am trying to use it on another project. In order to do that I use:

import my.app.myDateSpinner.*;

It compiles without any problem but I get the following error during runtime:

java.lang.NoClassDefFoundError: my/app/myDateSpinner/view/MyDateSpinnerView (wrong name: MyDateSpinnerView)

I don't understand why I am getting this error from MyDateSpinnerView and not from MyDateSpinnerModel or MyDateSpinnerController and I don't know how to solve it.


Solution

  • I've found the problem. It was the IDE (Dr. Java).

    I am not sure what happend but today when I opened it, it crashed. Then, I opened it again and all the settings were set to default. I had to set all the preferences again and everything worked just fine.