Home > Back-end >  Java. Lang. NoClassDefFoundError exception
Java. Lang. NoClassDefFoundError exception

Time:11-26

Idea run there is no problem, use maven jars console running tips

 Java. Lang. NoClassDefFoundError: org/json/JSONObject 


My pom. XML
 
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" & gt;
4.0.0 & lt;/modelVersion>

Org. Example
Untitled
1.0 - SNAPSHOT



Org, apache maven. Plugins
Maven - jar - plugin



Com. Example. Test//main program entrance class, can hold the control, stand-alone positioning to the class





Org, apache maven. Plugins
Maven - compiler - plugin

6 & lt;/source>
6 & lt;/target>






Cn. Hutool
Hutool - http
5.5.1 & lt;/version>


Cn. Hutool
Hutool - crypto
5.5.1 & lt;/version>


Cn. Hutool
Hutool - core
5.5.1 & lt;/version>


Cn. Hutool
Hutool - extra
5.5.1 & lt;/version>


Cn. Hutool
Hutool - cron
5.5.0 & lt;/version>



Org. Json
Json
20190722 & lt;/version>



CodePudding user response:

The JVM at run time will find the corresponding class in the classpath to load, but when it can't find the class, a Java has taken place. The lang. NoClassDefFoundError error, if the class you didn't take good care of the packaging to get lost
  • Related