Eclipse MapServer libmapscript.so: cannot open shared object file

Ryan Ollerenshaw ollerery at ENGR.ORST.EDU
Wed Jul 19 11:21:25 PDT 2006


Quoting Ryan Ollerenshaw <ollerery at engr.orst.edu>:

> Quoting Norman Barker <nbarker at ittvis.com>:
>
> >
> >
> > -----Original Message-----
> >
> > When trying to create a java application using eclipse i get the
> > following
> > error:
> >
> > java.lang.UnsatisfiedLinkError: libmapscript: libmapscript.so: cannot
> > open
> > shared object file: No such file or directory
> >
> > Here is my code:
> >
> > import  edu.umn.gis.mapscript.*;
> > import java.io.*;
> >
> > public class HelloServlet {
> >
> > 	public static void main(String[] args) {
> >
> > 	System.loadLibrary("mapscript");
> > 	      mapObj  map;
> > 	      imageObj image;
> >
> > 	      map=new
> > mapObj("/var/www/html/mapserver/htdocs/display.map");
> > 	      map.setProjection("init=epsg:4326");
> > 	      image=map.draw();
> > 	      image.save("test.png",map);
> >     }
> > }
> >
> > Ryan,
> >
> > You need to add the path variable to eclipse, so in eclipse do the
> > following
> >
> > Run -> Run -> (select your configuration) -> Environment -> add a
> > variable called path and set it to /usr/local/lib (or /usr/lib)
> >
> > Similary in Tomcat, or JBoss, you need to add -Djava.library.path=... to
> > run.bat
> >
> > Norman
> >
>
Here is the solution, once the library is copied to your working directory add
the following to the VM arguments in eclipse:
-classpath ./:./mapscript.jar -Djava.library.path=.

or  from the command line it looks like this:
#> javac -classpath ./:./mapscript.jar -Djava.library.path=.
#> java -classpath ./:./mapscript.jar -Djava.library.path=.



More information about the MapServer-users mailing list