NoClassDefFoundError on an interface, not a class

前端 未结 6 764
-上瘾入骨i
-上瘾入骨i 2020-12-21 00:05

I have an issue with NoClassDefFoundError. I am using interfaces, and no class definition should be available:

package code;
public interface Co         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 00:46

    Check the static initialization of this class. Look here: what is the difference between NoClassDefFoundError and ClassNotFoundException.
    java.lang.NoClassDefFoundError: code/Constants does not mean that the Constants class is not in the CLASSPATH. In fact it is quite the opposite. It means that the class was found by the ClassLoader, however when trying to load the class, it ran into an error reading the class definition. This typically happens when the class in question has static blocks or members which use a Class that's not found by the ClassLoader.

提交回复
热议问题