T
T
tincap2016-01-06 22:06:58
Java
tincap, 2016-01-06 22:06:58

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

2 answer(s)
E
Evgeny Kornachev, 2016-01-07
@tincap

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?

B
buksttabu, 2016-01-07
@buksttabu

IMHO, of course, but it's stupid to ask about NoClassDefFoundError, having enough skills to work with non-standard libraries

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question