[armedbear-devel] java interop question

Kevin Raison raison at chatsubo.net
Tue Oct 12 20:01:04 UTC 2010

I am an old hand at cl, but java is still a bit of a mystery to me.  I 
am particularly puzzled as to why, when trying to use the apache http 
components library to do a simple http get in abcl, I cannot make it 
work.  My code:

(defun http-get (url)
   (let* ((url (jnew (jclass "java.lang.String") url))
          (client-class (jclass 
          (client-obj (jnew client-class))
          (get-class (jclass "org.apache.http.client.methods.HttpGet"))
          (get-obj (jnew get-class url)))
     (jcall (jmethod client-class "execute") client-obj get-obj)))

And the java code from the apache tutorial 

HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://localhost/");
HttpResponse response = httpclient.execute(httpget);

For some reason, my code fails with
No such method: org.apache.http.impl.client.DefaultHttpClient.execute().

I do have the appropriate jars in my class path.

The java code specifically calls the execute method on its instantiated 
httpclient, but I cannot do the same from abcl.  This method is 
inherited from org.apache.http.impl.client.AbstractHttpClient, in case 
that makes a difference. 

Thanks for any insight!


More information about the armedbear-devel mailing list