3

I wish to parse JSON and for that I have downloaded java-json.jar file from this URL. I have added this in Build Path by

  1. Right click on the Project
  2. Build Path -> Configure Build Path -> Add External jars.
  3. Selected the jar and it shows in the "Referenced Libraries"

But import org.json.JSONArray gives me a error. Also when I stop at org. it gives me a few suggestions which does not include json.

What should I do to successfully import the json package?

Nikhil Sahu
  • 2,463
  • 2
  • 32
  • 48

1 Answers1

1

Build your project after including the jar.If it doesn't work, check whether the particular class you are looking for is present in the jar file or not.

sudipta06
  • 658
  • 7
  • 12
  • The class is present. And I had rebuild it immediately after adding the jar. The error still persisted. – Nikhil Sahu May 26 '15 at 09:23
  • In that case just copy the jar into your project and then add it in your build path from "Add jars" and then again compile your project – sudipta06 May 26 '15 at 10:22
  • It seems eclipse takes time to accept changes. I cleaned, rebuilt and restarted after adding the jars to build path but still it had errors. But I left the eclipse as is for a while and the error went away. Though I am curious as to what happened exactly. – Nikhil Sahu Jun 15 '15 at 13:25