On 8/4/06, Chong Yu Meng <chongym@xxxxxxxxxxxxxx> wrote:
On Thu, 2006-08-03 at 16:58 -0700, Ryan Ollerenshaw wrote: > I am able to compile a java mapscript file from the command line > using: > > javac -classpath ./mapscript.jar MapServerTest.java Hi Ryan, I'm not exactly sure what you are doing here. Are you trying to compile MapServerTest.java ? And does it require mapscript.jar for it to compile correctly? First, you should define the full path to the mapscript.jar file to avoid confusion, and next, after the compile, you should check that there is a file called MapServerTest.class in the same directory, if it does compile correctly (i.e. without errors).
System.LoadLibrary(); does not take a absolute path, but i did try using System.load() which can accept a full path to the library and the library does load at compile time (no errors at the System.Load() line), but at runtime i am still getting a UnsatisfiedLinkError when ever i try to use any of the functions from the library. System.load("/etc/tomcat5/webapps/my_test/WEB-INF/src/libmapscript.so");
> > But when i try to turn my code into a servelt and run it over Tomcat i > keep getting: > > java.lang.UnsatisfiedLinkError: no mapscript in java.library.path How are you running it in Tomcat? Have you defined a context, and does it work properly? You should test with a plain web page first to verify that the URL for the context really works.
yes i do get a class file and use all the basic java functions when i remove all the lines that are giveing my trouble.
> > I have tried adding: export CLASSPATH=./mapscript.jar > to my ./tomcat5/bin/startup.sh file but that does not seem to help. > Am i missing a setting somewhere, why cant Tomcat find the .jar file? > I have it in the same directory as my .java file and also > in /common/lib and /shared/lib IIRC libraries that are placed inside <tomcat-directory>/common/lib are available to all servlets. I'm not clear though on whether this is still the behaviour in Tomcat 5.5. But the thing is, if you *only* need to use the library for your servlet (presumably MapServerTest), you should place the library in the lib directory of your servlet context.
I have also place the .jar and .so files in the WEB-INF of the servelt that i am creating, still no luck. Also it is the .so file that i am trying to load, counld this be part of the problem, all the java documentation that i have seen talk about .jar files and not .so