Eclipse MapServer libmapscript.so: cannot open shared object file

Vitor Buitoni vitor.buitoni at DIGITRO.COM.BR
Wed Jul 19 13:15:00 EDT 2006


Ryan Ollerenshaw escreveu:
> 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
>>
>>     
>
> thank you but still no luck i am getting the same error message, and i am
> running Apache on Fedora Core 5 if that helps any.
>   

Inside eclipse, if you are using linux, you should add the environment 
variable LD_LIBRARY_PATH pointing to the directory where the file 
libmapscript.so is placed, in the Run configuration of your project. 
(the way Norman explained)

If you want it to work inside Tomcat (since you can't use java mapscript 
with Apache), you should follow these instructions: (I recommend you 
take a good look into it)
http://mapserver.gis.umn.edu/docs/howto/java_mapscript_Tomcat_55

The part of putting things inside $TOMCAT_HOME/shared/lib is important, 
this way the mapscript library will be loaded only once.
Also, I had to edit the file $TOMCAT_HOME/conf/setenv.sh , setting the 
environment variable LD_LIBRARY_PATH to point to the directory where 
libmapscript.so is. (-Djava.library.path is another option)

Another thing you shouldn't do in your code is to call 
System.loadLibrary() when things are running inside tomcat. This will be 
done automatically by mapscript.jar.

Vitor
>
>   



More information about the mapserver-users mailing list