-1

I'm trying to compile my java program using cmd. The program works well on the eclipse, but not on the cmd. The error message was cannot find a symbol under the variable that declared by JSONObject, JSONArray,...etc(JSON something).

So it seems like cmd can not recognize json.simple. I downloaded json simple on my desktop, and I successfully imported it. Also, I set a json-simple file for referenced libraries on the eclipse.

Why cmd can not find the imported json-simple file? Understanding the file and how it works with the compiler is too hard for me. Anyone knows good articles, videos, or book to study this?

Devep
  • 23
  • 4

1 Answers1

1

That will depend on how you added those libraries, since you have downloaded and manually linked the files to your project what you could do is use the -classpath option in the javac program something like javac -classpath PATH_TO_YOUR_JAR if you can choose next time try using a build tool like maven, gradle or ant, it's a bit more work to configure at the beginning but it makes sure your code can be compiled from the command line