java - Could not find class 'org.apache.http.entity.mime.content.Filebody', referenced from method -


what i'm trying send picture web server. when call method in android project following error: not find class 'org.apache.http.entity.mime.content.filebody', referenced method com.example.tc.send.send.

this happens eventhough i've got following imports:

import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.entity.mime.multipartentity; import org.apache.http.entity.mime.content.filebody; import org.apache.http.impl.client.defaulthttpclient; 

this class looks in method lies:

public class send { public send(){ }  public static string send(string path) throws exception {     string filepath = path;     string svar;      httpclient httpclient = new defaulthttpclient();     try {         httppost httppost = new httppost("path web server");          filebody pic = new filebody(new file(filepath));          multipartentity requestentity = new multipartentity();          requestentity.addpart("file", pic);          httppost.setentity(requestentity);         system.out.println("executing request " + httppost.getrequestline());         httpresponse response = httpclient.execute(httppost);         httpentity responseentity = response.getentity();         system.out.println("----------------------------------------");         system.out.println(response.getstatusline());          bytearrayoutputstream outstream = new bytearrayoutputstream();         response.getentity().writeto(outstream);         byte [] responsebody = outstream.tobytearray();         svar = new string(responsebody);         system.out.println(svar);      } {         try {             httpclient.getconnectionmanager().shutdown();         }          catch (exception ignore) {         }     }     return svar; } } 

can see problem is?

you need have httpmime-4.0.jar in classpath. may (i guess do) have jar project, inside application during runtime? if understand correctly android application. need have jar inthe classpath of android.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -