You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Priest <Ro...@bentley.com> on 2002/06/24 19:07:09 UTC

RE: how do I load a native library?

Unless I am missing something, it looks like it should work.

is "mapscript" the name of your dll?

Is "mapscript.dll" in your PATH?

-----Original Message-----
From: Andreas Hirner [mailto:andreas@projektinter.net]
Sent: Monday, June 24, 2002 1:08 PM
To: Tomcat Users List
Subject: how do I load a native library?


Hi,

I would like to load a native library for all applications in the
common/lib directory.
So I wrote the following code:

 public class InitMapserver
 {
   static
  {
     try {
        System.loadLibrary("mapscript");
        System.err.println("libmapscript.so loaded");
     } catch (UnsatisfiedLinkError e) {
        System.err.println("libmapscript.so not loaded: " + e);
     }
   }
 }

then I created a jar file and copied it into the common/lib directory.
After restarting tomcat, I called the class in a servlet using the
Class.forName method. Unfortunately this does not work.

What did I wrong?

Thanks Andreas



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: how do I load a native library?

Posted by Andreas Hirner <an...@projektinter.net>.
Hi

> Unless I am missing something, it looks like it should work.
> is "mapscript" the name of your dll?
I am working on Linux, so the shared library is called libmapscript.so

> Is "mapscript.dll" in your PATH?
as far as I am concerned the path to shared libraries is set in the
LD_LIBRARY_PATH variable and this is what I did. If I inculde the
static block listed in script below in a servlet and call the native
methods it works. That's why I think that the mistake has something to
do with way I call library in the InetMapserver class.

Thanks Andreas


> Hi,
>
> I would like to load a native library for all applications in the
> common/lib directory.
> So I wrote the following code:
>
>  public class InitMapserver
>  {
>    static
>   {
>      try {
>         System.loadLibrary("mapscript");
>         System.err.println("libmapscript.so loaded");
>      } catch (UnsatisfiedLinkError e) {
>         System.err.println("libmapscript.so not loaded: " + e);
>      }
>    }
>  }
>
> then I created a jar file and copied it into the common/lib
directory.
> After restarting tomcat, I called the class in a servlet using the
> Class.forName method. Unfortunately this does not work.
>
> What did I wrong?
>
> Thanks Andreas
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>