NoClassDefFoundError when running .jar file (json-simple) - eclipse

332 Views Asked by At

Sorry if I am talking nonsense, I am new to java and java projects.

I have been reading a lot of other peoples questions about the same problem, however even after trying, it doesn't seem to be working for me.

When I run my code in the eclipse ide, the code works perfectly as intended, however after I export it (file -> export -> Java (jar file) and set the main class in the manifest file section -> finish) and run it(outside in my terminal) the error

Unable to initialize main class (my main class)
Caused by java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException

In the build path I have added the external jar in the classpath and selected it in the Order and Export tab, which seemed to be most peoples problem.

I'm also a bit confused to why I am able to load all the other subclasses, such as json.simple.JSONObject and json.simple.parser.JSONParser, but not json.simple.parser.ParseException. (but I guess this could just be the order that they load in?)

I apologize if the answer was easily found somewhere else or is simple.

Thank you for your time if you read this far and any answer would be appreciated a lot.

0

There are 0 best solutions below