Answer the question
In order to leave comments, you need to log in
Why does the program start with the IDE, but gives an error in the console?
Connected the java-json library to IDEA. When I run the program through the IDE, everything works fine. But if you run it through the console, it says that it cannot find the library.
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONObject
at api.Info.getUserlist(Info.java:23)
at MyClass.main(MyClass.java:14)
Answer the question
In order to leave comments, you need to log in
It is clearly written, the org.json.JSONObject class is not defined.
Simply, when starting through the console, you need to specify the classpath (from where to pull the libraries), how to prescribe this parameter is written on the Internet, these are the basics.
You have included the library, but how?
is it a link to a jar? then IDEA knows where to get the resources from, and when you run it in the console, you do not provide this information.
- jar added to source folder? same situation.
- maven?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question