Add JSON Package Reference; new to Java

Matt picture Matt · Apr 18, 2011 · Viewed 83.4k times · Source

I'm brand new to Java and have always been a c kind-of-guy. That being said, I'm trying to use the JSON libraries (packages? classes? Java terminology is so damn confusing!) and am having issues adding them as a reference.

These three imports cannot be resolved:

import org.json.simple.JSONArray;

import org.json.simple.JSONObject;

import org.json.simple.JSONValue;

I went to json.org and downloaded the Java libraries but I'm not sure what to do with them. I've tried to go into project properties and add an external class to no avail. I noticed the downloaded folder is full of .java files. What am I supposed to do with these?

Sorry to present such a noob question on here, but I'm stumped.

Answer

MeBigFatGuy picture MeBigFatGuy · Apr 18, 2011
  • Right click on the Eclipse project,
  • choose Properties
  • Select Java Build Path
  • Click the libraries tab
  • click add external jars
  • find the json jar(s) and add them.