cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl java interface on linux

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 8 Aug 2003 09:51:06 +0200 (CEST)

On Wed, 6 Aug 2003, Forrest Cahoon wrote:

> I thought, hey, libcurl is probably just the thing! It says they have a
> java interface right here on their web page! I posted to their devel list
> that I would try to come up with libcurl-based download implementation.
>
> THEN I downloaded the java interface code. Oh, ok, this hasn't gotten very
> far yet. It won't even compile on linux. But I'm not giving up; someone
> has to get this thing to work.

Yeah. It actually once worked, when I wrote it and tested it on Solaris. I've
since been trying to find someone who wants to nurse and care for the binding,
as I'm not very suitable for the job.

> I changed the Makefile with an eye towards platform-independence, but I
> still have some linux-specific stuff in it.

It will need some configure type of thing to make it really platform
independant.

> TARGET = javacurl.so

I thought it should be called 'libjavacurl.so'.

> The '.' expected seems to me to imply that it wants CurlGlue and CurlWrite
> to be in a package. I experimented a little bit with that (using "package
> libcurl;" although I suppose it should really be "package se.haxx.curl;")
> and it was quite a bit more complex. I got test.java to compile though,
> although I couldn't run it because it said it couldn't find main (???).

Since you mailed I've tried to restore the binding to the state I once had it
in, when it worked. Only this time using a different java version (don't you
just love how java changes with each version) and operating system.

I too had to make it a package ("curl" in my case), but unfortunately I too
failed to get the test program to run. Or actually, I've made it start but it
fails like this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: jni_init
        at curl.CurlGlue.jni_init(Native Method)
        at curl.CurlGlue.<init>(CurlGlue.java:132)
        at test.main(test.java:20)

> 1) Does anyone know how I might be able to fix my test.java compile errors
> _without_ putting the interface code into a package?

I think this takes a true java programmer to step forward. I am far from one.

> 2) Should I fix up the code to use a package?
> 2a) "libcurl" or "se.haxx.curl" or something else?

Considering this doesn't even work, I'd say that basicly any change you can
come up with that makes it work is fine.

> 3) Does anyone working in a different environment want to help come up with
> a truly platform-independent Makefile? Linux is the only really convenient
> development environment I have to work on this with.

I can assist in making a configure script or similar that generates a Makefile
in a portable manner. If you just get it to work on Linux first...

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-08-08