Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8568151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:02:42+00:00 2026-06-11T18:02:42+00:00

new Thread(new Runnable() { public void run() { HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(),

  • 0
  new Thread(new Runnable() {
                public void run() {
                    HttpClient client = new DefaultHttpClient();
                    HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit
                    HttpResponse response;
                    JSONObject json = new JSONObject();
                    try{
                        HttpPost post = new HttpPost(URL);
                        post.setHeader("Content-type", "application/json");
                        json.put("username", userName);
                        json.put("password", password);
                        StringEntity se = new StringEntity( json.toString());
                        se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
                        post.setEntity(se);
                        response = client.execute(post);
                        /*Checking response */
                        if(response!=null){
                            String temp = EntityUtils.toString(response.getEntity()); //Get the data in the entity
                            JSONObject json2 = (JSONObject)new JSONParser().parse(temp);

                            //JsonObject o = new JsonParser().parse(temp).getAsJsonObject();
                            Log.v("response", json2.get("state").toString());
                    }}
                    catch(Exception e){
                        e.printStackTrace();
                        //createDialog("Error", "Cannot Estabilish Connection");
                    }
                }
              }).start();

I have this code and this returns the “temp” string. I wanted to parse this string to JSON object and I also added the json-simple 1.1.1.jar to my refferenced libraries. But the classnotfound error and classdeffound errors shows up in log cat. how to resolve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:02:43+00:00Added an answer on June 11, 2026 at 6:02 pm

    Don’t add jar files like that..follow these steps

    You should try this:

    1. Remove all references to the JAR in your project from Java project -> properties -> Java build path -> libraries

    2. Create a libs folder if not exist at the root of your project Copy the JAR into the libs folder.

    3. If still not running OK. Right click your project > Android Tools > Fix Project Properties

    clean your project and run. it will work

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Stop a thread like: new Thread ( new Runnable() { public void run(){ if
Thread thread = new Thread(new Runnable() { @Override public void run() { try {
private void playSound(){ Log.d(TAG,Play SOund); new Thread(new Runnable() { public void run() { MediaPlayer
public void aMethod(){ new Thread(new Runnable() { public void run() { int decide =
Thread t1= new Thread(new Runnable() { public void run() { //perform Database stuff }
new Thread(new Runnable() { public void run() { while ( statusStr==null) { progressBarHandler.post(new Runnable()
Code: public void doSomethingOrThrowUncheckedException() { Thread worker = new Thread(new Runnable() { public void
public class Test { private static void funct(final int i) { new Thread(new Runnable()
public class ThreadTest { public static void main(String[] args) { Runnable runnable = new
So, I have a code: ((Button) findViewById(R.id.run)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.