I’m new to Java and have searched for quite a time now on the internet to a solution to my problem. I’m trying to add the JSON classes folder to my web app. The folder for JSON classes can be retrieved from this link: http://www.json.org/java/. What I did is copied the folder to my WEB-INF/lib folder and added that folder to my classpath by rightclick on Libraries -> Build Path -> Configure Build Path -> Add Class Folder. Ok so far so good! Btw, is this the right procedure for adding class folders? But what shall I type in a new Java class?
I have tried import JSONArray, but it is not working. Could you please give the right syntax for importing the JSON classes?
You need to use the fully-qualified class name, which includes the package:
(And yes, that is the correct way to add classes/jars to your project’s classpath in Eclipse.)