JSON issue in Java


I have the following code and attached image jars in my buildpath but the program fails to run with exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JSONSerializer;

public class JSONEx {

	public static void createJSONArray()
		HashMap m1 = new HashMap();		
		m1.put("1", "a");
		m1.put("2", "b");
		HashMap m2 = new HashMap();		
		m2.put("3", "c");
		m2.put("4", "d");

		ArrayList al = new ArrayList();

		JSONArray ja = new JSONArray();

		for(int i = 0; i < al.size(); i++)
			HashMap m = (HashMap)al.get(i);
			Set s = m.keySet();
			Iterator it = s.iterator();
			JSONObject jo = new JSONObject();

				String s1 = (String)it.next();
				System.out.println("S1: " + s1);
				String val = (String)m.get(s1);
				System.out.println("Val: " + val);
				jo.put(s1, val);

	public static void parseJSONArray()
		String s = "{'foo':'bar','coolness':2.0,'altitude':39000,'pilot':{'firstName':'Buzz','lastName':'Aldrin'},'mission':'apollo 11'}";

		// JSON serializer returns JSON object.
		JSONObject json = (JSONObject)JSONSerializer.toJSON(s);
		double coolness = json.getDouble("coolness");
		int altitude = json.getInt("altitude");
		JSONObject pilot = json.getJSONObject("pilot");
		String firstName = pilot.getString("firstName");
		String lastName = pilot.getString("lastName");
		System.out.println("Coolness: " + coolness);
		System.out.println("Altitude: " + altitude);
		System.out.println("Pilot: " + pilot);	
		System.out.println("First Name & Last Name: " + firstName + " " + lastName);

	public static void main(String[] args) {
		// TODO Auto-generated method stub


Open in new window

LVL 12
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jazzIIIloveAuthor Commented:

commons-lang 2.6

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jazzIIIloveAuthor Commented:
correct versions..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.