0

I am trying to use a library in my java project, I am using intelij IDEA. For some reason, in IDEA I don't have any errors, the code compile, but when I build an artefact and run it I have this error :

Exception in thread "main" java.lang.NoClassDefFoundError: org/json/simple/parser/JSONParser

I have import the class in the file where I use the librarie and json-simple is in my module list.

enter image description here

enter image description here

enter image description here

stark max
  • 63
  • 5
  • _"when I build an artefact and run it"_ Are you running it from IntelliJ, or from the command line? If the latter, can you please share the command you're using? – dnault Oct 28 '20 at 00:27
  • Check the jar content - does it actually have the `org/json/simple/parser/JSONParser` class file? – Andrey Oct 28 '20 at 07:42
  • @Andrey It does contain the jar file at the root (in project.jar I have json-simple-1.1.1.jar) – stark max Oct 28 '20 at 09:00
  • @dnault I am running it from command line: java -jar project.jar. – stark max Oct 28 '20 at 09:02
  • Ok I just found the solution, in my 3rd screen, the librairie is imported to the project, in the project I do not have the `org/json/simple/parser/JSONParser` class file. the librarie need to be extracted (right click on Available content > extract). Thx for the help – stark max Oct 28 '20 at 09:09

0 Answers0