java
runtime_error
ai_generated
true
java.lang.ClassDefNotFoundException
ID: java/class-def-not-found-error
80%Fix Rate
85%Confidence
1Evidence
2023-11-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Java 8 | active | — | — | — |
| Java 11 | active | — | — | — |
| Java 17 | active | — | — | — |
| Java 21 | active | — | — | — |
Root Cause
The JVM cannot find the definition of a class that was referenced at compile time, typically due to a missing or mismatched class file in the classpath or an incomplete build artifact.
generic中文
JVM 无法找到编译时引用的类的定义,通常是由于类路径中缺少或不匹配的类文件,或构建产物不完整。
Official Documentation
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ClassNotFoundException.htmlWorkarounds
-
85% success Run 'mvn clean install' or 'gradle clean build' to force a full rebuild and ensure all class files are generated correctly.
Run 'mvn clean install' or 'gradle clean build' to force a full rebuild and ensure all class files are generated correctly.
-
75% success Check the classpath using 'java -verbose:class YourMainClass' to see which class files are loaded and identify the missing one.
Check the classpath using 'java -verbose:class YourMainClass' to see which class files are loaded and identify the missing one.
中文步骤
Run 'mvn clean install' or 'gradle clean build' to force a full rebuild and ensure all class files are generated correctly.
Check the classpath using 'java -verbose:class YourMainClass' to see which class files are loaded and identify the missing one.
Dead Ends
Common approaches that don't work:
-
40% fail
This may include duplicate or conflicting versions of the same class, leading to other linkage errors, and does not address missing dependencies from transitive dependencies.
-
60% fail
Stale class files from previous builds can mask the real issue; a clean build is necessary to ensure all classes are regenerated.